0
votes

I have created a simple form in Excel 2010 in which I wish to replace the individual text string value in 11 cells in the cell range B5 : B15

I have used this code to test the first cell at B5 which is referenced in A5 by the Label Christian Name and I have labelled the text box on the form Christian_Input:

Private Sub Christian_Input_Change()

ThisWorkbook.Worksheets("Sheet1").Cells(5, 1) = Christian_Input.Text
End Sub

When I enter a new text string in the form and run it, the form simply appears over my Sheet1 with the replacement text in the input text box but the text string in cell B5 is neither highlighted or replaced.

Finally when I open the file the form is not visible.

Can anyone please advise what alterations I need to make.

1
How do you run the form?stenci

1 Answers

0
votes
ThisWorkbook.Worksheets("Sheet1").range("B5:B15").value = Christian_Input.Text
ThisWorkbook.Worksheets("Sheet1").range("B5").select

Add the following to your "This Workbook" module to auto-start the form when you open the workbook (replace UserFormNameHere with the name of your form):

Private Sub Workbook_Open()
    UserFormNameHere.show   
End Sub