Auto Fill Macro

ctc005

New Member
Joined
Jul 20, 2007
Messages
15
I have never written a macro, but I think I can figure it out with a little help.

What I need to do is I have an area set up in my spreadsheet that has calculations (about 130 rows worth) They can all be dragged manually out to the right to fill in how large I need it. They are broked down by month (i.e. my column headers are months) I want a macro to autofill to the right based on how many years I input into G10. So if I entered 10 I want it to copy (i believe a loop is what its called?) the formulas I have in cells J11 through J130 across to the right for 10 years (120 months). Any help is appreciated. Or if I am being too vague let me know.
 

Excel Facts

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.
No need for a loop.
Code:
With Range("J1:J130")
    .Copy .Offset(, 1).Resize(, Range("G10") * 12)
End With
 
Upvote 0
when I run it, it highlights range and tells me

Compile Error:
Invalid or unqualified reference
 
Upvote 0
had a typo, found it and corrected it, it works now, thanks sincerely for your assistance.
 
Upvote 0

Forum statistics

Threads
1,214,833
Messages
6,121,862
Members
449,052
Latest member
Fuddy_Duddy

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top