Copying formula down multiple columns

sgtilley

New Member
Joined
May 27, 2015
Messages
1
Hi

I have the following code but want to run the same formula down adjacent columns using a loop. I don't know what to replace the "B3:B" with to pick up the next column.
Simon

Sub Macro1()
'
' Macro1 Macro
Sheets("Sheet1").Select
Dim col As Integer
Dim row As Integer
Dim counter As Integer
col = 1
'Copies formula Across active cells

Range("B2").Select
LC = Cells(1, Columns.Count).End(xlToLeft).Column
Range(Cells(2, 9), Cells(2, LC)).FormulaR1C1 = "=('Refined SOP Data'!RC*RC6)/RC7"
Range(Cells(2, 9), Cells(2, LC)).NumberFormat = "0.0"

'Copies formula down active cells
Range("B3").Select 'Starting point for copying formula down active columns
For counter = 1 To LC
With Sheets("Sheet1")
.Range("B3:B" & .Cells(.Rows.Count, "A").End(xlUp).row).Formula = "=RC[-2]+RC[-1]" 'I want to select the next column ie C3:C but don't know how
.Range("B3:B" & .Cells(.Rows.Count, "A").End(xlUp).row).NumberFormat = "0.0" 'I want to select the next column ie C3:C but don't know how
End With
Next

End Sub
 

Excel Facts

Fastest way to copy a worksheet?
Hold down the Ctrl key while dragging tab for Sheet1 to the right. Excel will make a copy of the worksheet.

Forum statistics

Threads
1,203,462
Messages
6,055,563
Members
444,799
Latest member
CraigCrowhurst

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