-
vb for excel
I am using VB fo Excel. I want to activate a sheet of a workbook. The name of the workbook is entered as data ( thanks to your help) with no problem. Now I want to Activate a worksheet of the above workbook, also entered as data. I tried several alternatives to enter this sheet as data, but all failed. Any help?. Thank you. Norah
-
MyString = "sheet1"
Worksheets(MyString).activate
-
Hi Norah,
On the Excel sheet.
Press Alt + F11
Go to Insert | Module
Type This:
Sub Active()
MyString = "BOQ"
Worksheets(MyString).Activate
End Sub
Where BOQ is the sheet name that you want to Activate. You can replace it with any other name that you have.
Now Press Alt + F11 again to come back to excel and from the Tools | Macro run Active.
Plus you can assign this to a button as well to avoid going to Tools | Macro.
Best Regards,
S h a n
-
Am I missing something or isn't it simpler to just click the sheet
tab at the bottom of the workbook to activate that sheet instead
of creating a toolbar button to simulate the sheet tab click?
Or is this being used in automation?
:confused:
-
well, people like automation these days.
Assume you have 70-80 sheets on a workbook. This might help there. isn't it ?
Best Regards,
S h a n