identify items in a list and create sheets

  • Thread starter Thread starter jrh
  • Start date Start date
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.
 
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
 
Back
Top