vba Range().Select

Pinaceous

Well-known Member
Joined
Jun 11, 2014
Messages
1,124
Office Version
  1. 365
Platform
  1. Windows
Hello Everyone,

How would you create a macro for the curser to go to
Code:
 Range(A1).Select
for every ODD sheet?

Likewise, how would you create a macro for the curser to go to
Code:
 Range(B1).Select
for every EVEN sheet?

Many thanks in advance!
Pinaceous
 
IF you are going with sheetnames, change .CodeName to .Name in post #9 . Change Ken to FORMAT. Change K1 to B11. Change Sheet3 to TOTALS.
 
Last edited:
Upvote 0

Excel Facts

What do {} around a formula in the formula bar mean?
{Formula} means the formula was entered using Ctrl+Shift+Enter signifying an old-style array formula.
Code:
Private Sub Workbook_SheetActivate(ByVal Sh As Object)
    If Sh.Name = "TOTALS" Then
        Sh.[C1].Activate
    ElseIf Sh.Name = "FORMAT" Then
        Sh.[B11].Activate
    ElseIf Sh.Index Mod 2 = 0 Then
        Sh.[B1].Activate
    Else
        Sh.[A1].Activate
    End If
End Sub
 
Upvote 0
Thank you Kenneth & Dim Me xlNoob !! I'm going to go with post #12 for my application.
 
Last edited:
Upvote 0

Forum statistics

Threads
1,223,236
Messages
6,170,917
Members
452,366
Latest member
TePunaBloke

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top