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!
'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
A sample workbook to try this on, too, would be most helpful. Click on GO ADVANCED in a new message and use the paperclip icon to upload on for us. The problem could be in the dataset.
_________________
Microsoft MVP 2010 - Excel
Visit: Jerry Beaucaire's Excel Files & Macros
If you've been given good help, use theicon below to give reputation feedback, it is appreciated.
Always put your code between code tags. [CODE] your code here [/CODE]
“None of us is as good as all of us” - Ray Kroc
“Actually, I *am* a rocket scientist.” - JB (little ones count!)
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks