a few days ago I used one piece of coding from someone who helped me create a list in a new sheet with a program that checks a column in a different sheet, and at each cell, it makes sure that the value is the string "daily". I wanted to do the same after it's done with the first do-until but it does not seem to execute the second do-until.
Private Sub PopulateTaskList()
Dim wMS As Worksheet, wsTL As Worksheet, rngC As Range
Dim boolExists As Boolean, i As Long
'Create new sheet named
For i = 1 To Worksheets.Count 'check if the sheet exists
If Worksheets(i).Name = "Task List" Then
Set wsTL = Worksheets(i)
boolExists = True
Exit Sub
End If
Next i
If Not boolExists Then
Sheets.Add(After:=Sheets(Sheets.Count)).Name = "Task List"
Set wsTL = Worksheets("Task List")
End If
Set wMS = Worksheets("MSS")
Set rngC = wMS.Range("C3")
Do Until rngC.Value = ""
If rngC.Value = "Daily" Then
wsTL.Rows("2:2").EntireRow.Insert
rngC.Copy wsTL.Range("B2") 'if you place the range in clipboard, it will be copied during the row insertion...
rngC.Offset(0, 1).Copy wsTL.Range("D2")
rngC.Offset(0, -2).Copy wsTL.Range("C2")
rngC.Offset(0, -1).Copy wsTL.Range("A2")
End If
Set rngC = rngC.Offset(1) 'set the range as the next cell down
Loop
Do Until rngC.Value = ""
If rngC.Value = "Weekly" Then
wsTL.Rows("2:2").EntireRow.Insert
rngC.Copy wsTL.Range("B2") 'if you place the range in clipboard, it will be copied during the row insertion...
rngC.Offset(0, 1).Copy wsTL.Range("D2")
rngC.Offset(0, -2).Copy wsTL.Range("C2")
rngC.Offset(0, -1).Copy wsTL.Range("A2")
End If
Set rngC = rngC.Offset(1) 'set the range as the next cell down
Loop
End Sub
Basically, I want to do the first do until with the if condition having the daily and then the second do until with the if condition having the weekly but it only executes the first one. I tried adding an else if but as soon as it hits a weekly on the column that it evaluates it starts doing the weekly if and the idea is that it first finishes all the dailys and then moves on to the weeklys.