Miss__Excel
New Member
- Joined
- Aug 11, 2015
- Messages
- 13
Hi all,
Been struggling with this for a bit, figured it was time to ask for help.
I have a bunch of formulas in columns B through R.
I need to autofill these formulas from the second row (the first is headers) to the last row in my spreadsheet. The last row is dynamic based on data, so I've been using lastrow.
Here's my code:
Range("B2:R2").Select
Selection.AutoFill Destination:=Range("B2:R" & lastrow)
There's a bunch of stuff above it having to do with the formulas I need in columns B through R, but that seems to work just fine.
I should mention this was working a little while ago, but I tweaked some of the formulas in the columns (mostly, added an IF statement) and now, I'm getting Runtime Error 1004 'range of object'_Global' failed error on the Selection.AutoFill Destination:=Range("B2:R" & lastrow) line.
The "IF" statements have to do with the character in column R (Y/N), so I don't know if the problem is that column R is to the right of all the others. Autofilling manually (not via macro) works fine.
My VBA knowledge is basically nonexistent, so I appreciate any help you can give.
Thank you!
Been struggling with this for a bit, figured it was time to ask for help.
I have a bunch of formulas in columns B through R.
I need to autofill these formulas from the second row (the first is headers) to the last row in my spreadsheet. The last row is dynamic based on data, so I've been using lastrow.
Here's my code:
Range("B2:R2").Select
Selection.AutoFill Destination:=Range("B2:R" & lastrow)
There's a bunch of stuff above it having to do with the formulas I need in columns B through R, but that seems to work just fine.
I should mention this was working a little while ago, but I tweaked some of the formulas in the columns (mostly, added an IF statement) and now, I'm getting Runtime Error 1004 'range of object'_Global' failed error on the Selection.AutoFill Destination:=Range("B2:R" & lastrow) line.
The "IF" statements have to do with the character in column R (Y/N), so I don't know if the problem is that column R is to the right of all the others. Autofilling manually (not via macro) works fine.
My VBA knowledge is basically nonexistent, so I appreciate any help you can give.
Thank you!