M
Michael Vaughan
Hello Everyone,
Can somebody tell me why this gets a Subscript out of range error??? It
errors out at the vArray(I) at the bottom.
Sub findLastCell_Without_Scrolling()
Dim lLastrow As Long, vArray As Variant
Dim scrollCol As Integer, scrollRow As Integer
Dim I As Integer
'store the scroll settings
scrollCol = ActiveWindow.ScrollColumn
scrollRow = ActiveWindow.scrollRow
'set a range variable to the first blank
lLastrow = Range("A1").End(xlDown).Row
'apply the stored scroll settings
ActiveWindow.ScrollColumn = scrollCol
ActiveWindow.scrollRow = scrollRow
'display the cell found
'MsgBox firstBlank.Address
vArray = Range("A1:A" & lLastrow).Value
For I = 1 To lLastrow
If vArray(I) = "11/10/2004" Then MsgBox "The Date is " & I: Exit For
Next I
'write results out to a column range
Range("G5:G" & lLastrow).Value = vArray
End Sub
Can somebody tell me why this gets a Subscript out of range error??? It
errors out at the vArray(I) at the bottom.
Sub findLastCell_Without_Scrolling()
Dim lLastrow As Long, vArray As Variant
Dim scrollCol As Integer, scrollRow As Integer
Dim I As Integer
'store the scroll settings
scrollCol = ActiveWindow.ScrollColumn
scrollRow = ActiveWindow.scrollRow
'set a range variable to the first blank
lLastrow = Range("A1").End(xlDown).Row
'apply the stored scroll settings
ActiveWindow.ScrollColumn = scrollCol
ActiveWindow.scrollRow = scrollRow
'display the cell found
'MsgBox firstBlank.Address
vArray = Range("A1:A" & lLastrow).Value
For I = 1 To lLastrow
If vArray(I) = "11/10/2004" Then MsgBox "The Date is " & I: Exit For
Next I
'write results out to a column range
Range("G5:G" & lLastrow).Value = vArray
End Sub