Hi all,
I am trying to run 2 for each loops inside another loop, and I was wondering if there is a way to move to the next value for all loops at the same time.
So when it reaches "Next starting, final, scal", all ranges move to the next cell before performing the formula.
Sub blank()
Dim scal As Range, final As Range, starting As Range, Distinct As Worksheet, Sheet57 As Worksheet, Lager As Workbook
Set Lager = ActiveWorkbook
Set Distinct = Sheets("Distinct Discounts")
Set Sheet57 = Sheets("Sheet57")
Sheets("Distinct Discounts").Select
LLR = Range("A" & Rows.Count).End(xlUp).Row
Sheets("Sheet57").Select
Rw = Range("A" & Rows.Count).End(xlUp).Row
Range("B2").Select
For Each scal In Distinct.Range("B1:B" & LLR)
For Each final In Distinct.Range("C1:C" & LLR)
For Each starting In Distinct.Range("D1:D" & LLR)
ActiveCell.FormulaR1C1 = _
"=IF(COUNTBLANK('Weekly Promotions'!RC[" & starting.Value & "]:RC[" & final.Value & "])<" & scal.Value & ",1,0)"
ActiveCell.Select
Selection.AutoFill Destination:=Range(ActiveCell, cells(Rw, ActiveCell.Column))
ActiveCell.Offset(0, 1).Select
Next starting, final, scal
End Sub
Thanks in advance.
Bookmarks