Sub CopyDataCB() ' ' CopyData Macro ' ' 'determine Last Row Dim LastRow As Variant Dim SourcePath As String SourcePath = "C:\Users\smalghan\Desktop\q11070\01_Working\Quantities_StormCAD.xlsx" Workbooks.Open (SourcePath) Worksheets("Catch Basin").Activate LastRow = ActiveSheet.Cells(ActiveSheet.Rows.Count, "A").End(xlUp).Address MsgBox "LastRow: " & LastRow 'Determine last cell Dim LastCell As String LastCell = Range("A1").SpecialCells(xlCellTypeLastCell).Address MsgBox "LastCell:" & LastCell ActiveWorkbook.Close Worksheets("Catch Basin").Activate Range("A1").Select ActiveCell.FormulaR1C1 = "='C:\Users\smalghan\Desktop\q11070\01_Working\[Quantities_StormCAD.xlsx]Catch basin'!RC" Selection.AutoFill Destination:=Range("A1:LastRow"), Type:=xlFillDefault End Sub
Bookmarks