A
andibevan
I am using the following code to select the last row of a data table.
Set last = LastCell(Sheet2)
Cells(last.Row,"A").Select
What line would I need to use to copy the contents of cells from ro
A2:AA2 on Sheet3 (Sheet 3) to the last row?
The "LastCell" statement is a bit of written code used to find the las
row:-
Function LastCell(ws As Worksheet) As Range
Dim LastRow&, LastCol%
' Error-handling is here in case there is not any
' data in the worksheet
On Error Resume Next
Any ideas??
Thanks
Andi
With ws
' Find the last real row
LastRow& = .Cells.Find(What:="*", _
SearchDirection:=xlPrevious, _
SearchOrder:=xlByRows).Row
' Find the last real column
LastCol% = .Cells.Find(What:="*", _
SearchDirection:=xlPrevious, _
SearchOrder:=xlByColumns).Column
End With
' Finally, initialize a Range object variable for
' the last populated row.
Set LastCell = ws.Cells(LastRow&, LastCol%)
End Function
:
Set last = LastCell(Sheet2)
Cells(last.Row,"A").Select
What line would I need to use to copy the contents of cells from ro
A2:AA2 on Sheet3 (Sheet 3) to the last row?
The "LastCell" statement is a bit of written code used to find the las
row:-
Function LastCell(ws As Worksheet) As Range
Dim LastRow&, LastCol%
' Error-handling is here in case there is not any
' data in the worksheet
On Error Resume Next
Any ideas??
Thanks
Andi
With ws
' Find the last real row
LastRow& = .Cells.Find(What:="*", _
SearchDirection:=xlPrevious, _
SearchOrder:=xlByRows).Row
' Find the last real column
LastCol% = .Cells.Find(What:="*", _
SearchDirection:=xlPrevious, _
SearchOrder:=xlByColumns).Column
End With
' Finally, initialize a Range object variable for
' the last populated row.
Set LastCell = ws.Cells(LastRow&, LastCol%)
End Function
: