![]() |
Refer to another Sheet (Easy)
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!! |
Refer to another Sheet (Easy)
try:
Sheets("Sheet2").Cells(6,27).Value = UserForm1.TextBox1 cheers, Matt. wrote in message ... 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!! |
Refer to another Sheet (Easy)
You could use the line Worksheets("Sheet2").Activate to select sheet
before the userform enters the data. Simo -- Message posted from http://www.ExcelForum.com |
Refer to another Sheet (Easy)
Thanks guys...problem solved!!!
-----Original Message----- You could use the line Worksheets("Sheet2").Activate to select sheet 2 before the userform enters the data. Simon --- Message posted from http://www.ExcelForum.com/ . |
All times are GMT +1. The time now is 05:07 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com