Refer to another Sheet (Easy)

G

Guest

I have a pop-up text box that fires under certain
conditions in my "Sheet2". The user enters text and it is
saved to "Sheet2" when the user hits the command button.
This works fine when "Sheet2" is active, however when in
another sheet, the data is not written to Sheet2 (likely
because it is not the active sheet). How do I specify it
should be wriiten to Sheet2 in the example below?

Private Sub CommandButton1_Click()
Cells(6, 27) = UserForm1.TextBox1
Cells(6, 29) = UserForm1.TextBox2
Cells(6, 28) = Now()
Unload UserForm1
End Sub

Thanks for any tips!!
 
S

Simon Lloyd

You could use the line Worksheets("Sheet2").Activate to select sheet
before the userform enters the data.

Simo
 
Top