Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default How do make a macro activate the next sheet?


I have a macro that i want to run in many files that have the same
structure but diferent number of sheets. I can only change sheets by
writing:

Sheets("Sheet1").Activate

I would like to know if there is a command that would work, something
like:

ActiveSheet.Activatenext (I tried this and didn't work)

Can someone tell me how to do this?


--
pauloreiss
------------------------------------------------------------------------
pauloreiss's Profile: http://www.excelforum.com/member.php...o&userid=29820
View this thread: http://www.excelforum.com/showthread...hreadid=497860

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default How do make a macro activate the next sheet?

Almost got it.

activesheet.next.activate

--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)

"pauloreiss" wrote
in message ...

I have a macro that i want to run in many files that have the same
structure but diferent number of sheets. I can only change sheets by
writing:

Sheets("Sheet1").Activate

I would like to know if there is a command that would work, something
like:

ActiveSheet.Activatenext (I tried this and didn't work)

Can someone tell me how to do this?


--
pauloreiss
------------------------------------------------------------------------
pauloreiss's Profile:

http://www.excelforum.com/member.php...o&userid=29820
View this thread: http://www.excelforum.com/showthread...hreadid=497860



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default How do make a macro activate the next sheet?

Hi Paul,

Try:

'=============
Public Sub Tester01()
Sub TestA()
With ActiveSheet
If .Index < Sheets.Count Then
.Next.Activate
Else
Sheets(1).Activate
End If
End With
End Sub
'<<=============

---
Regards,
Norman



"pauloreiss" wrote
in message ...

I have a macro that i want to run in many files that have the same
structure but diferent number of sheets. I can only change sheets by
writing:

Sheets("Sheet1").Activate

I would like to know if there is a command that would work, something
like:

ActiveSheet.Activatenext (I tried this and didn't work)

Can someone tell me how to do this?


--
pauloreiss
------------------------------------------------------------------------
pauloreiss's Profile:
http://www.excelforum.com/member.php...o&userid=29820
View this thread: http://www.excelforum.com/showthread...hreadid=497860



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
Activate Sheet After Move Macro jlclyde Excel Discussion (Misc queries) 2 December 17th 08 07:27 PM
how would activate the previous sheet in macro Vicky Excel Discussion (Misc queries) 1 May 27th 06 09:18 AM
Return to Current Sheet in On (sheet activate) event macro Paul Moles Excel Programming 1 March 27th 05 03:16 PM
Activate Macro on Activating a sheet Bob Phillips[_6_] Excel Programming 0 June 4th 04 05:19 PM
macro to make different tabs in a same sheet vikram Excel Programming 2 May 4th 04 12:20 PM


All times are GMT +1. The time now is 08:35 PM.

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"