Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Data from one sheet to several based on category

I have a spreadsheet that contains a control list of all volunteers on a
given day for a not-for-profit. The first worksheeet has all individuals
listed by area where they are volunteering. I have to provide the leader of
each area with a list of his/her volunteers. The categories are in column
"K." Both the number of volunteers and number of cateogories changes daily. I
would like the macro to provide a separate tab for each category. I found
some code to create separate sheets for each horizontal page break. But that
doesn't help as the number of volunteers per area varies. But if someone
could explain how to clear all existing page breaks and insert them based on
change in category, I can make it work.

Thanks for your help.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 74
Default Data from one sheet to several based on category

Hi Andy,

You can use this to remove all present sheets and create a new serie.
You must be sure to use this only when you are on the sheet with all
info.

Sub SheetForEachCategory()
Dim wsTest As Worksheet
Dim wsActive As Worksheet
Dim sTemp As String

Set wsActive = ActiveSheet
' remove all existing catagorysheets
Application.DisplayAlerts = False
For Each wsTest In ActiveWorkbook.Worksheets
If wsTest.Name < wsActive.Name Then
wsTest.Delete
End If
Next
Application.DisplayAlerts = True

' create new catagorysheets
Range("K1").Select
Do
sTemp = ActiveCell.Value

On Error Resume Next
Set wsTest = Worksheets(sTemp)
On Error GoTo 0
If wsTest Is Nothing Then
ActiveWorkbook.Worksheets.Add After:=wsActive
ActiveSheet.Name = sTemp
End If
wsActive.Activate
ActiveCell.Offset(1, 0).Select
Loop Until IsEmpty(ActiveCell)

End Sub


Hoop this helps


Executor

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Data from one sheet to several based on category

Thank you.

It works great.

Andy

"Executor" wrote:

Hi Andy,

You can use this to remove all present sheets and create a new serie.
You must be sure to use this only when you are on the sheet with all
info.

Sub SheetForEachCategory()
Dim wsTest As Worksheet
Dim wsActive As Worksheet
Dim sTemp As String

Set wsActive = ActiveSheet
' remove all existing catagorysheets
Application.DisplayAlerts = False
For Each wsTest In ActiveWorkbook.Worksheets
If wsTest.Name < wsActive.Name Then
wsTest.Delete
End If
Next
Application.DisplayAlerts = True

' create new catagorysheets
Range("K1").Select
Do
sTemp = ActiveCell.Value

On Error Resume Next
Set wsTest = Worksheets(sTemp)
On Error GoTo 0
If wsTest Is Nothing Then
ActiveWorkbook.Worksheets.Add After:=wsActive
ActiveSheet.Name = sTemp
End If
wsActive.Activate
ActiveCell.Offset(1, 0).Select
Loop Until IsEmpty(ActiveCell)

End Sub


Hoop this helps


Executor


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
A SUB CATEGORY USING DATA VALIDATION? ALRDY USNG DV FOR CATEGORY sameer Excel Discussion (Misc queries) 2 January 11th 10 12:55 PM
Filter / Lookup: Display record on new sheet based on category... MeatLightning Excel Discussion (Misc queries) 1 April 14th 08 12:58 AM
How to Sum Up sales data by a product category from another sheet Jason_Shanghai Excel Worksheet Functions 4 December 21st 05 08:21 PM
How to Sum Up sales data by a product category from anther sheet mel_zhang Excel Worksheet Functions 0 December 21st 05 07:32 PM
Summing Data based on Its Category sip8316 Excel Discussion (Misc queries) 2 May 24th 05 07:30 PM


All times are GMT +1. The time now is 02:06 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"