The code below attempts to parse the worksheet COPY_APR_All_States based upon the state (column "F") by making a new worksheet (named by State, the "holdState" variable) for every state found in column "F" of COPY_APR_All_States, and then adding the respective rows to the new worksheet.
I have checked that COPY_APR_All_States is populated and sorted correctly, and I have added Error Checking to the Sub. However, the code below only creates a Worksheet for DC (there's another 12 states in COPY_APR) and does not copy any of the rows. I don't receive any errors when this task is executed or completed.
Any ideas on what is wrong here?
Thanks in advance!
<!-- END TEMPLATE: bbcode_code -->
I have checked that COPY_APR_All_States is populated and sorted correctly, and I have added Error Checking to the Sub. However, the code below only creates a Worksheet for DC (there's another 12 states in COPY_APR) and does not copy any of the rows. I don't receive any errors when this task is executed or completed.
Any ideas on what is wrong here?
Thanks in advance!
Code:
'Create A Worksheet for Each State then Copy & Paste the Information
Sheets("Copy_APR_ALL_States").Select
Range("F3").Select
holdState = ActiveCell.Value
For i = 1 To 750
If holdState <> "" Then
Set state = Sheets.Add
Sheets.Add.Name = holdState
Do While UCase(ActiveCell.Value) = UCase(holdState)
Range("F" & i + 2).Select
ActiveCell.EntireRow.Select
Selection.Copy
Sheets(holdState).Select
Range("A" & i).Select
Selection.Paste
Sheets("Copy_APR_ALL_States").Select
Range("F" & i + 2).Select
ActiveCell.Offset(1, 0).Select
Loop
Else
ActiveCell.Offset(1, 0).Select
End If
holdState = ActiveCell.Value
Next i