+ Reply to Thread
Results 1 to 2 of 2

chose next page

Hybrid View

  1. #1
    mike allen
    Guest

    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. #2
    Dave Peterson
    Guest

    Re: 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 to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1