ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   identify items in a list and create sheets (https://www.excelbanter.com/excel-programming/277999-identify-items-list-create-sheets.html)

jrh

identify items in a list and create sheets
 
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.

Brad[_7_]

identify items in a list and create sheets
 
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

-----Original Message-----
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.
.



All times are GMT +1. The time now is 09:30 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com