Consulting

Results 1 to 3 of 3

Thread: Solved: Sub to Go Back to Stored Range

  1. #1

    Solved: Sub to Go Back to Stored Range

    I am using the Store Sub to store the sheet index, and cell and row of a cell.

    Then I want to go back to that stored range using the goback Sub, however I keep getting the error, Subscript out of Range.

    [VBA]Sub store()
    Dim Sheetnumber As Integer
    Dim columnj As Integer
    Dim rowi As Integer

    Sheetnumber = ActiveSheet.Index
    columnj = ActiveCell.Column
    rowi = ActiveCell.Row


    End Sub
    Sub goback()
    Sheets(Sheetnumber).Select
    Cells(rowi, columnj).Select
    End Sub[/VBA]

  2. #2
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    [vba]

    Public Sheetnumber As Long
    Public columnj As Long
    Public rowi As Long

    Sub store()

    Sheetnumber = ActiveSheet.Index
    columnj = ActiveCell.Column
    rowi = ActiveCell.Row


    End Sub
    Sub goback()
    Sheets(Sheetnumber).Select
    Cells(rowi, columnj).Select
    End Sub
    [/vba]
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  3. #3

Posting Permissions

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