Hello-
I am trying to write the below macro (I have changed the sheet names and truncated the formula for privacy). I need help on the last line of the autofill, how can I write it since my starting point is an offset? The formula should be there for all the rows, but now I need it to autofill to the right for the number of columns in the data.
Many thanks in advance for you help.
Regards,
nwd9s
I am trying to write the below macro (I have changed the sheet names and truncated the formula for privacy). I need help on the last line of the autofill, how can I write it since my starting point is an offset? The formula should be there for all the rows, but now I need it to autofill to the right for the number of columns in the data.
Code:
Sheets("Sheet1").Activate
Dim NBVColumn As Long
NBVColumn = Range("A" & Rows.Count).End(xlUp).Row
Dim NBVRow As Long
NBVRow = Range("A" & Columns.Count).End(xlToRight).Column
Range("A3:A" & NBVColumn).End(xlToRight).Offset(2, 0).Formula = "=FORMULA"
ActiveCells.AutoFill Destination:=Range("ActiveRange:ActiveRange" & NBVRow), Type:=xlFillDefault
Many thanks in advance for you help.
Regards,
nwd9s