Home |
Search |
Today's Posts |
|
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Use VBE Sheet names in code
Same answer as on the 8th.
Was there a problem? In the project explorer, if your entries look like A (Sheet1) B (Sheet2) C (Sheet3) so that A, B and C are the codenames of the sheet. Sub AAAABB() Dim VC As Object Dim i As Long Dim varr(1 To 3) i = 0 For Each VC In ThisWorkbook.VBProject.VBComponents If VC.Type = vbext_ct_Document Then Select Case LCase(VC.Name) Case "a", "b", "c" i = i + 1 varr(i) = VC.Properties("Name").Value If i = 3 Then Exit For End Select End If Next Worksheets(varr).Select Worksheets(varr(1)).Activate End Sub -- Regards, Tom Ogilvy "Steve" wrote in message news:3fafb7d9$0$22362$afc38c87@... Hi. I have the following code: Sheets(Array("Sheet1", "Sheet2", "Sheet3")).Select Sheets("Sheet1").Activate I have named my sheets in the VBE to A, B and C. How do I rewrite the above code using the VBE names? Thanks! |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
using the Excel generic worksheet names instead of user-given names in code | Excel Discussion (Misc queries) | |||
Code names for excel sheets | Excel Discussion (Misc queries) | |||
Getting & Using Sheet Names or Index in VBA code | New Users to Excel | |||
Cell names = sheet names | Excel Worksheet Functions | |||
Sheet names code | Excel Discussion (Misc queries) |