mmetzinger
Board Regular
- Joined
- Dec 30, 2010
- Messages
- 61
I have the following code
This part of the code works just fine. What I need now is to take the list of agent names that exist between "FirstAgent" and "LastAgent" and name each of the newly created sheets with that name.
Code:
'---------------------------------------------------------------------------------------------------------
'Create sheets for all agents in column E V2.0
'--------------------------------------------------------------------------------------------------------
Dim FirstAgent As String
Dim LastAgent As String
Columns("E:E").Select
Selection.Find(What:="Agent Name", After:=ActiveCell, LookIn:=xlFormulas _
, LookAt:=xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=True, SearchFormat:=False).Activate
FirstAgent = ActiveCell.Row + 1
Selection.Find(What:="Totals", After:=ActiveCell, LookIn:=xlFormulas, _
LookAt:=xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=True, SearchFormat:=False).Activate
LastAgent = ActiveCell.Row - 1
'Make all the sheets for the agents
Dim makesheets As Integer
Do Until makesheets = LastAgent + 1
Sheets.Add After:=Sheets(Sheets.Count)
Loop
This part of the code works just fine. What I need now is to take the list of agent names that exist between "FirstAgent" and "LastAgent" and name each of the newly created sheets with that name.