FryGirl
Well-known Member
- Joined
- Nov 11, 2008
- Messages
- 1,368
- Office Version
- 365
- 2016
- Platform
- Windows
I have about 10 Const as String formulas and need to loop thru them column by column. It starts with column 3.
The part in Red, need to change in the loop, but can't get the right syntax to change the last digit of the sFormula to grab the next formula for the next column.
I tried sFormula & i, but that failed
The part in Red, need to change in the loop, but can't get the right syntax to change the last digit of the sFormula to grab the next formula for the next column.
Code:
Sub dkdk()
Const sFormula3 As String = "=My_a_Value"
Const sFormula4 As String = "=(COUNTIFS(Data!$T$2:$T$638675,$B2,Data!P$2:P$638675,D$1)/60)*1.2138"
Const sFormula5 etc....
Dim i As Long
With Sheet7
For i = 3 To 12
.Range(Cells(2, i), Cells(LR, i)).Formula = [COLOR=#ff0000]sFormula1[/COLOR]
.Columns(i).Value = .Columns(i).Value
Next i
End With
End Sub
I tried sFormula & i, but that failed
Last edited: