VBA noob needs help.

Halljrod

New Member
Joined
Jul 8, 2013
Messages
3
I need excel to insert a formula into a row i.e. (A3:G3) then skip down to Row 5 and insert the same formula. I need Excel to do this all the way down to row 10080. I have tried combining a few VBA codes but nothing has worked. The code that shows the most promise is:

Sub xyz()
Dim i As Integer
For i = 3 To 10080 Step 2
Cells(i, 1).Formula = "=SUM(B1:C1)"
Next
End Sub

However, this formula only inserts my formula into column A. Please help!
 

Excel Facts

Wildcard in VLOOKUP
Use =VLOOKUP("Apple*" to find apple, Apple, or applesauce
That's interesting, I never thought about changing the actual formula into a different format. This also presents a huge problem because the formula that I posted with my question is not the formula that I need to replicate. The formula in question is:

=IF(A2="FL",MAX(INDEX('Draft HUD'!$O$12:$U$15,,MATCH(A1,'Draft HUD'!$O$11:$U$11,0))),INDEX('Draft HUD'!$O$12:$U$15,MATCH(Permutations!A2,'Draft HUD'!$N$12:$N$15,0),MATCH(Permutations!A1,'Draft HUD'!$O$11:$U$11,0)))

Should I change this to AR1C1 or change the way the VBA is structured? Thanks for all of your help thus far!
 
Upvote 0
Turn on the macro recorder and enter the formula manually. You should then get some code that uses R1C1 style references.
 
Upvote 0

Forum statistics

Threads
1,214,817
Messages
6,121,720
Members
449,050
Latest member
MiguekHeka

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