I have two problems. here is the first;

In Excel I have a userform that prompts the user to enter values in text boxes. I then assign the values entered in the text boxes to various cells as follows;

Range("B8").Value = TextBox1.Value

Is there a more correct way of doing this I am not sure if I should be using Range.

OK, here is my next problem;

The userform is presented by a Do While loop so the user can enter a second, third, fourth etc etc set of values. Each time they enter set of values I want to increment the row number where they are copied to. Thus I need a counter variable to represent the row number. How do I incorporate this into the statement that copies the value from the text box to the cell I am guessing it is something like;

Range("rowCounter8").Value = TextBox1.Value

rowCounter = rowCounter + 1

Any ideas

Re: Assigning text box input to cells

Andy Pope


You could use

Range("B" & Rowcounter).Value = Textbox1.Value


Cells(RowCounter,2).value = Textbox1.Value