using sheet1 name

lezawang

Well-known Member
Joined
Mar 27, 2016
Messages
1,565
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

Can a formula spear through sheets?
Use =SUM(January:December!E7) to sum E7 on all of the sheets from January through December

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
40,626
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,565
"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
40,626
Office Version
365
Platform
Windows
You're welcome & thanks for the feedback
 

Watch MrExcel Video

Forum statistics

Threads
1,099,018
Messages
5,466,071
Members
406,463
Latest member
vstruggs

This Week's Hot Topics

Top