T
troy_lee
Here is my code:
Dim LastRow As Long
Dim LastCol As Long
Dim LastCell As Range
Dim intNumCols As Long
Dim DataCells As Range
'Find the last row, column and last cell of the worksheet.
LastRow = ActiveSheet.Cells(Rows.Count, 1).End(xlUp).Row
LastCol = ActiveSheet.Cells(1, Columns.Count).End(xlToLeft).Column
LastCell = ActiveSheet.Cells(LastRow, LastCol).Address
Excel fails at the LastCell line. It tells me that the object is not
defined, but clearly my variable is defined. Both LastRow and LastCol
return the correct value.
What is the problem?
Thanks in advance.
Dim LastRow As Long
Dim LastCol As Long
Dim LastCell As Range
Dim intNumCols As Long
Dim DataCells As Range
'Find the last row, column and last cell of the worksheet.
LastRow = ActiveSheet.Cells(Rows.Count, 1).End(xlUp).Row
LastCol = ActiveSheet.Cells(1, Columns.Count).End(xlToLeft).Column
LastCell = ActiveSheet.Cells(LastRow, LastCol).Address
Excel fails at the LastCell line. It tells me that the object is not
defined, but clearly my variable is defined. Both LastRow and LastCol
return the correct value.
What is the problem?
Thanks in advance.