I finally have the copying aspects of my macro working, after much help here thanks. To discuss the next stage I've attached a much simplified version of both source and destination workbooks used.
The macro currently copies data from Source-Simplified.xlsm to fixed row 8 of WalkIndex-Extract.xlsm
I want to edit that to copy instead to the first row in which col A is empty, row 4 in my example. The first run would therefore enter two cells into row 4, instead of row 8. And so on, as the number of rows increases.![]()
Sub Extract_Simplest() Dim wi As Workbook Set wi = Workbooks("WalkIndex-Extract.xlsm") Dim wb As Workbook Set wb = Workbooks("Source-Simplified.xlsm") 'Track name wb.Worksheets("Track Data").Range("B5").Copy _ Workbooks("WalkIndex-Extract.xlsm").Sheets("Target").Range("C8") 'Main FW Heading (C6 & B3 in formula) wb.Worksheets("Track Data").Range("B27").Copy wi.Sheets("Target").Range("D8").PasteSpecial Paste:=xlPasteValues End Sub
This code finds the first empty row OK.
But attempts to use 'FirstEmpty' in Sub Extract_Simplest() have so far defeated me and any help would be appreciated please![]()
Sub FirstEmptyRowA1() 'Find the first empty row in Column A Dim lngLastRow As Long lngLastRow = Cells(Rows.Count, "A").End(xlUp).Row Dim FirstEmpty As Long FirstEmpty = lngLastRow + 1 MsgBox (FirstEmpty) End Sub
Bookmarks