From
http://www.mrexcel.com/board/viewtopic.php?topic=4847&forum=2
http://www.mrexcel.com/board/viewtopic.php?topic=4847&forum=2
On 2002-04-16 12:26, Jay Petrulis wrote:
On 2002-04-16 11:05, Cosmos75 wrote:
I have a Worksheet with names (Column A) and info/values to the right (Columns B to E).
Each names appears more than once.
Is there a macro that can copy each persons’ info to a auto-generated sheet named after the person?
Hi,
Short answer:
1. Get a list of unique names and add a sheet, then name it the person's name
a) advanced filter and cycle through the list
b) loop through the list of names and determine whether the sheet exists or not. If it does, go on, else add the sheet.
2. Cycle through the data list and add each item to the appropriate sheet. You will match the name in the cell and transfer the data to the relevant sheet.
These two can/should be separate routines as you will only have to add sheets initially and/or when new people are added.
Here is a function (adapted from John W. Power Programming book) which can be called to determine if a sheet exists or not.
--------------------
Public Function SheetExists(sheetname) As Boolean
Dim abc As Object
On Error Resume Next
Set abc = ActiveWorkbook.Sheets(sheetname)
If Err = 0 Then SheetExists = True _
Else SheetExists = False
End Function
--------------------
This should get you started.
HTH,
Jay