Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Sheet names in VBE

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:3fac1008$0$14371$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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Sheet Referencing - autofilling sheet names Pat Excel Worksheet Functions 2 June 4th 09 03:50 AM
Cell names = sheet names Vince Excel Worksheet Functions 9 February 8th 08 03:59 PM
Add Names of First Sheet and Automatically Add to Second Sheet Jorge Excel Discussion (Misc queries) 1 October 12th 06 10:48 PM
sheet names Paweł Gałecki Excel Discussion (Misc queries) 2 March 4th 05 01:15 PM
I want to print out the sheet tabs (sheet names) Sundus Excel Worksheet Functions 3 February 23rd 05 08:34 PM


All times are GMT +1. The time now is 11:12 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"