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
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