Hi,

I would like to auto fill my data based on a dynamic range. I have a variable name
row_count, which counts the number of rows to be filled. If row_count is
equal to 45, it will fill down to 45 rows. Can someone explain to me why this
code doesn't work?

Doesn't work:

Range("A2:G2").Select ' Select A2 to G2

Selection.AutoFill Destination:=Range("A2G & row_count)") ' with the selection fill to from A2 to G45


Work:


Range("A2:G2").Select ' Select A2 to G2

Selection.AutoFill Destination:=Range("A2:G45") ' with the selection fill to from A2 to G45

Thank you for you help