How can I reference and create new sheets in excel

Viewed 33

I am trying to create a list in order from a small database. Basically, I am trying to check in and tell the program to go from C3 in the MSS sheet until it finds an empty cell. While it goes down I wrote an if statement that is supposed to copy the info in C3 and its surroundings into another sheet that the program is supposed to create named task list. I want to do this for daily, then weekly, and so on. So far I have tried to do the daily but it doesn't seem to work.

Here is the code.

Private Sub TaskListContent()
'Creates new worksheet to make a task list
Const wsName As String = "MSS"

Sheets.Add(After:=Sheets(Sheets.Count)).Name = "Task List"

Worksheets("MSS").Activate
Range("C3").Select
Do Until ActiveCell.Value = ""
    If ActiveCell.Value = "Daily" Then
        ActiveCell.Copy
        ActiveCell.FormulaR1C1 = "Daily"
        Worksheets("wsName_tskl").Rows("2:2").EntireRow.Insert
        Worksheets("wsName_tskl").Range("B2").Paste
        ActiveCell.Offset(0, 1).Select
        Worksheets("wsName_tskl").Range("D2").Paste
        ActiveCell.Offset(0, -2).Select
        Worksheets("wsName_tskl").Range("C2").Paste
        ActiveCell.Offset(0, -1).Select
        Worksheets("wsName_tskl").Range("A2").Paste
    End If
Loop
    

End Sub

I can't seem to create the task list sheet and also can't seem to reference the MMS sheet. enter image description here

0 Answers
Related