More Macro Madness
this will create the worksheets
Private Sub CommandButton1_Click()
x = 1 ' starting Row
y = 2
Do While Range("A" & x) < "" ' change "A" to your column where the
states are.
Sheets("Sheet2").Select
Sheets("Sheet1").Copy After:=Sheet1
Sheets("Sheet1 (2)").Select
Sheets("Sheet1 (2)").Name = Sheet1.Cells(x, 1)
x = x + 1: y = y + 1
Loop
End Sub
Then you can just use a loop and an "if" statement to move the records to
the correct worksheet.
"Josh in Tampa" wrote in message
...
i have an excel worksheet. one of the columns in this
worksheet lists the appropriate state abbreviation for
each record (ie., FL, NY, CA, TX, etc.). i would like to
sort my worksheet by state, and then break my worksheet up
into several different worksheets (if this is even
possible).........so that instead of having one worksheet
with a bunch of different states, i could have as many
worksheets as there are states listed.
i'd like to go from one worksheet with the states i listed
above........to something like:
worksheet 1: all the FL records
worksheet 2: all the NY records
worksheet 3: all the CA records
worksheet 4: all the TX records
and so on and so forth.....
any ideas out there? thanks in advance!
|