I'm fairly new to Excel, so bear please bear with me.
I'm trying to make a macro that autofills up. The range that it needs to fill changes, so I've made a string variable(insStr) that has the cell range needed.
I've recorded a macro while doing this manually and the code is exact the same aside from the variable. Also, my string has the same value as the range that comes up in the recorded macro (I've used a msgbox to double check). The recorded macro works fine when run, yet mine does not.
Error message is:
Run-time error '1004':
AutoFill method of Range class failed
What am I missing here? Are you not able to use a variable for the range?
Here is the code:
Range(insStr).Select
Selection.AutoFill Destination:=Range(insStr), Type:=xlFillDefault
Range(insStr).Select
Thank you,
Ben
I'm trying to make a macro that autofills up. The range that it needs to fill changes, so I've made a string variable(insStr) that has the cell range needed.
I've recorded a macro while doing this manually and the code is exact the same aside from the variable. Also, my string has the same value as the range that comes up in the recorded macro (I've used a msgbox to double check). The recorded macro works fine when run, yet mine does not.
Error message is:
Run-time error '1004':
AutoFill method of Range class failed
What am I missing here? Are you not able to use a variable for the range?
Here is the code:
Range(insStr).Select
Selection.AutoFill Destination:=Range(insStr), Type:=xlFillDefault
Range(insStr).Select
Thank you,
Ben