Copy/paste formula to variable # of data

[Solved/Closed]
Report
-
 B -
Hello,

I'm recording a macro where I have data in Col A (it's variable, it can be 5K rows one month, 6K rows another month). I want to copy a formula in col B based on the data in col A. Hence my problem with it being variable.

Thank you!

1 reply

Posts
1864
Registration date
Sunday June 14, 2009
Status
Contributor
Last seen
August 7, 2021
803
not clear. whatever be the length of colun A and you are having a formula in B1(or B2 if B1 is column heding) you can copy B2 down provided you take care of absolute and relative references of cells in the formula

post the formula in B2
Sorry my question wasn't clear but I'm recording a macro and I found this code in this forum and it worked beautifully! Exactly what I was looking for.

Selection.AutoFill Destination:=Range("B7:H" & Range("A" & Rows.Count).End(xlUp).Row)