Refer to another Sheet (Easy)

  • Thread starter Thread starter Guest
  • Start date Start date
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!!
 
try:

Sheets("Sheet2").Cells(6,27).Value = UserForm1.TextBox1

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

Simo
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top