Need VBA code for formula reference in loop

Elysium4Eternity

New Member
Joined
May 7, 2018
Messages
12
Hello, I'm fairly new to VBA and there's something I'm struggling with.
xk64Mm.png

So I want to get the answer of cells G3*I3 in cell K3. That's not a problem so far. But now I want a code so that in K6 I will have the answer of G6*I6, in K9 the answer of G9*I9, and so on. In my original file I need to repeat this about 1000 times. I'm having a really hard time figuring this out...

Thanks in advance!
 

Excel Facts

Highlight Duplicates
Home, Conditional Formatting, Highlight Cells, Duplicate records, OK to add pink formatting to any duplicates in selected range.
Hi, try this:

<code> Sub macro()
Dim i As Integer
For i = 3 To 1000 Step 3
Cells(i, 11).Value = Cells(i, 7).Value * Cells(i, 9).Value
Next i
End Sub

Replace 1000 by number of your rows.
<code></code>
</code>
 
Last edited:
Upvote 0
Hi & welcome to MrExcel.
how about
Code:
Sub AddFormula()
   Dim i As Long
   For i = 3 To 1000 Step 3
   Range("K" & i).FormulaR1C1 = "=rc[-4]*rc[-2]"
   Next i
End Sub
 
Upvote 0
Glad we could help & thanks for the feedback
 
Upvote 0

Forum statistics

Threads
1,214,653
Messages
6,120,756
Members
448,990
Latest member
Buzzlightyear

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