PDA

View Full Version : Solved: Sub to Go Back to Stored Range



MachaMacha
08-21-2009, 08:42 AM
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.

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

Bob Phillips
08-21-2009, 09:01 AM
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

MachaMacha
08-21-2009, 09:07 AM
Thanks!