I need to write a macro that makes the code go one sheet to the right. Normally i would just select Sheets("Sheetname").select but this macro will be used to add more sheets in.
Any Ideas?
I need to write a macro that makes the code go one sheet to the right. Normally i would just select Sheets("Sheetname").select but this macro will be used to add more sheets in.
Any Ideas?
Try something like
Sub AAA()
On Error Resume Next
If Not ActiveSheet.Next Is Nothing Then
ActiveSheet.Next.Activate
Else
Sheets(1).Activate
End If
End Sub
This will select the sheet to the right, if there is one. If
you're at the last sheet, it will loop around to the first sheet.
--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com
"chalky" <chalky.2b8wj6_1153401309.0347@excelforum-nospam.com>
wrote in message
news:chalky.2b8wj6_1153401309.0347@excelforum-nospam.com...
>
> I need to write a macro that makes the code go one sheet to the
> right.
> Normally i would just select Sheets("Sheetname").select but
> this macro
> will be used to add more sheets in.
>
> Any Ideas?
>
>
> --
> chalky
> ------------------------------------------------------------------------
> chalky's Profile:
> http://www.excelforum.com/member.php...o&userid=23758
> View this thread:
> http://www.excelforum.com/showthread...hreadid=563277
>
Ah thank you very much!
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks