PDA

View Full Version : [SOLVED] Copy + Paste to Last Row based on Last Row of adjacent Column



tatendamark
09-20-2017, 03:05 AM
I am running the code below to input info from multiple workbooks to one workbook with multiple worksheets,
but I would like the auto-fill for column C to end in line with where the last data point in column A ends and not at C700.


(Data in Column A varies in length i.e. number of rows with data varies from sheet to sheet).

e.g. if the last data point in Column A is at A33, then Column C's last data point should be at C33.


Your assistance is greatly appreciated.


Parts of Code:


lastRow = wsM.Range("C700").End(xlUp).Row + 2
wsM.Cells(3, 3).Formula = "=A3/B3"
wsM.Cells(3, 3).AutoFill Destination:=wsM.Range("C3:C700")

mdmackillop
09-20-2017, 03:55 AM
lastrow = wsm.Cells(Rows.Count, 1).End(xlUp).Row
wsm.Cells(3, 3).Formula = "=A3/B3"
wsm.Cells(3, 3).AutoFill Destination:=wsm.Range("C3:C" & lastrow)

tatendamark
09-20-2017, 05:31 AM
Awesome! Works perfectly. Thanx