using sheet1 name

lezawang

Well-known Member
Joined
Mar 27, 2016
Messages
1,559
Hi
I have 3 sheets and they are showing in the vba editor/project window as following:

- sheet1(hello1)
- sheet2(hello2)
- sheet3(hello3)

I am moving these sheets around using vba code and I want to make sure that sheet1 is the active one after whatever move I do. I remember once I used code name to activate sheet1(hello1), but it does not work now

Code:
Sub abc()
    Workbooks(1).Sheet1.Activate
End Sub
I am trying to avoid using worksheets("hello1")
 
Last edited:

Some videos you may like

Excel Facts

How to create a cell-sized chart?
Tiny charts, called Sparklines, were added to Excel 2010. Look for Sparklines on the Insert tab.

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
39,053
Office Version
365
Platform
Windows
Do not specify the workbook.
Codenames refer to the workbook, that contains the code
 

lezawang

Well-known Member
Joined
Mar 27, 2016
Messages
1,559
"Codenames refer to the workbook, that contains the code"
Did not know that. Thank you so much.
 

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
39,053
Office Version
365
Platform
Windows
You're welcome & thanks for the feedback
 

Watch MrExcel Video

Forum statistics

Threads
1,096,287
Messages
5,449,459
Members
405,566
Latest member
JeIIyfish

This Week's Hot Topics

Top