identify items in a list and create sheets

J

jrh

hello.
I have a column with names of people, names can be
repeated. I want to create a new sheet for each person
that appears, their name as a sheet name. How do I write
the code to have excel identify the different names and
make a tab for each person that appears?

thank you.
 
B

Brad

Would it be alright if you sorted the column by name? It
simplifies things. If not I think you would need to
collect an array of names in strName and evaluate it in a
nested for each loop.

Dim objName As Object
Dim rngNameList As Range
Dim strName As String
Dim shtNew As Worksheet

' Define your range of names.

strName = ""
For Each objName In rngNameList
If objName.Value <> strName Then
strName = objName.Value
Set shtNew = Worksheets.Add ' Might use After here.
shtNew.Name = strName
End If
Next

HTH

-Brad
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top