MWE
08-30-2005, 09:21 AM
I have a simple little proc that examines a Range and returns the "corners"
Sub xlRangeProps(xlTargetRange As Range, FirstRow, LastRow, FirstCol, LastCol)
On Error GoTo ErrorState
FirstRow = xlTargetRange.Row
MsgBox "1"
LastRow = FirstRow + xlTargetRange.Rows.Count - 1
MsgBox "2"
FirstCol = xlTargetRange.Column
MsgBox "3"
LastCol = FirstCol + xlTargetRange.Columns.Count - 1
Exit Sub
ErrorState:
FirstRow = -1
LastRow = -1
FirstCol = -1
LastCol = -1
End Sub
The MsgBox lines are just to track the progress of the proc. At one time, it ran fine. But it is now failing on the LastRow = line.
What is wrong?
Sub xlRangeProps(xlTargetRange As Range, FirstRow, LastRow, FirstCol, LastCol)
On Error GoTo ErrorState
FirstRow = xlTargetRange.Row
MsgBox "1"
LastRow = FirstRow + xlTargetRange.Rows.Count - 1
MsgBox "2"
FirstCol = xlTargetRange.Column
MsgBox "3"
LastCol = FirstCol + xlTargetRange.Columns.Count - 1
Exit Sub
ErrorState:
FirstRow = -1
LastRow = -1
FirstCol = -1
LastCol = -1
End Sub
The MsgBox lines are just to track the progress of the proc. At one time, it ran fine. But it is now failing on the LastRow = line.
What is wrong?