Hi need some help ...
Say i have loop as below, but what i want is to run another loop within this loop so that every time the original loop reaches 10 cycles it wold run the second loop, but on the final time the original loop may not run 10 cycles so i would want the second loop to run even if 10 cycles has not been completed just for the last one..
maybe use a count etc?
Say i have loop as below, but what i want is to run another loop within this loop so that every time the original loop reaches 10 cycles it wold run the second loop, but on the final time the original loop may not run 10 cycles so i would want the second loop to run even if 10 cycles has not been completed just for the last one..
maybe use a count etc?
Code:
For Each d1 In rng1 For Each d2 In rng2
On Error Resume Next
ActiveWorkbook.Sheets.Add After:=Worksheets(Worksheets.Count)
Worksheets(Worksheets.Count).Name = d2 & "-" & d1
oldD = d1.Offset(0, 1)
oldU = d2.Offset(0, 1).Value
Sheets("Temp").Select
ActiveSheet.UsedRange.Copy
Worksheets(Worksheets.Count).Select
Range("B1").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Cells.Replace What:= c1.Offset(0, 1).Value, Replacement:=& c1.Value, LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False
Cells.Replace What:= & c2.Offset(0, 1).Value, Replacement:= & c2.Value, LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False
Sheets.Add After:=Sheets(Sheets.Count)
Worksheets(Worksheets.Count).Select
'new loop here
Next d2
Next d1