Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 85
Default chose next page

this does work, but i would like to reduce it (as it gets much bigger than
even this):

sub test()
ActiveSheet.Next.Next.Next.Next.Next.Cells(1, 1) = "ok"
end sub

i want to choose the 5th sheet down from where i am now. i will not always
be on first sheet when running this, nor will i know the name of the 5th
sheet down.
i was thinking something like:
ActiveSheet.Next(5).Cells(1, 1) = "ok" (this does not work)
thanks, mike allen


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default chose next page

With no validation:

Option Explicit
Sub test()
Dim myIndex As Long
myIndex = ActiveSheet.Index
Sheets(myIndex + 5).Cells(1, 1).Value = "ok"
End Sub


mike allen wrote:

this does work, but i would like to reduce it (as it gets much bigger than
even this):

sub test()
ActiveSheet.Next.Next.Next.Next.Next.Cells(1, 1) = "ok"
end sub

i want to choose the 5th sheet down from where i am now. i will not always
be on first sheet when running this, nor will i know the name of the 5th
sheet down.
i was thinking something like:
ActiveSheet.Next(5).Cells(1, 1) = "ok" (this does not work)
thanks, mike allen


--

Dave Peterson
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
chose days by month Dave Excel Discussion (Misc queries) 1 August 21st 07 12:16 AM
Chose two printers with vba Matos Excel Programming 1 May 7th 06 05:43 PM
How can I get Excel to automatically chose one of two answers? Erwin Excel Discussion (Misc queries) 4 April 4th 06 02:58 PM
Macro to chose what to print John Excel Discussion (Misc queries) 1 October 1st 05 07:59 PM
How can I set up to chose more than 1 item from a dropdown list (. microchick Excel Discussion (Misc queries) 4 April 7th 05 06:59 PM


All times are GMT +1. The time now is 03:59 AM.

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"