ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Totally Stuck...Help Please! (https://www.excelbanter.com/excel-programming/386244-re-totally-stuck-help-please.html)

JLatham

Totally Stuck...Help Please!
 
That's often a good idea, as is breaking complex worksheet formulas into
pieces to see which part(s) of those may be causing problems.

"urkec" wrote:

Sub Button2_Click()
With Sheets("Site Reading Log") 'source
.Rows(.Cells(Rows.Count, "a").End(xlUp).Row).Copy Sheets("sheet16").Rows(1)
'destination

End With


End Sub


I think you should break your code in steps to see which line gives you an
error:


Sub Button2_Click()

'Go to the first cell of the source sheet
Set rng = Worksheets("Source").Range("A1")

'Simulate ctrl + down arrow
'to get the index of the last row
rowToCopy = rng.End(xlDown).Row

'Copy the last row
Worksheets("Source").Rows(rowToCopy).Copy _
Worksheets("Dest").Rows(1)

End Sub


--
urkec



All times are GMT +1. The time now is 08:44 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com