Public Sub CreateWorksheetList()
'This is done when the data is exported just in case there is a change in the reports
'that are being created. It is used to check against the database if there
'are any new accounts that have not been entered there.
Dim rngTOC As Range, rngWksName As Range
Dim rngAccount As Range
Set wksTOC = Worksheets("Table_Of_Contents")
wksTOC.Activate
Set rngTOC = Range("Z2")
For Each wks In Worksheets
If wks.Name Like "Acct_*" Then
Set rngWksName = rngTOC.Offset(1, 0)
rngTOC.Value = CStr(Right(wks.Name, 6))
Set rngTOC = rngWksName
End If
Next
Set rngAccount = wksTOC.Range("Z2").End(xlDown).Offset(0, 0).Select
End Sub
|