LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default Generate sheetnames and skip cells?

Hi,

I am getting close to completing a project, but running into a few
snags. The first one is that part of the code is not executing
correctly. Here is the full code, below. WeeklyTallyNames is designed
to insert the names of the worksheets into cells D3,G3,J3,M3,etc. I
need to be able to exclude a few sheets, namely "Team Listing",
"Weekly Tally" and "Template" which are not generated by
"TabsFromList". GenerateAgents is run from a button on Team Listing.
Another issue is that not all of the sheet names are being inserted.
The list is in the format, (Lastname, First) I am aware that
TabsFromList will not work with dates, although a fix for that would
be great!

Any ideas?


Sub TabsFromList()
'David McRitchie based on previous code in sheets.htm
Application.ScreenUpdating = False
Dim cell As Range
Dim newName As String, xx As String
Err.Description = ""
On Error Resume Next
'--cells with numbers, including dates, will be ignored,
For Each cell In Intersect(Selection, _
Selection.SpecialCells(xlConstants, xlTextValues))
'Sheets.Add after:=Sheets(Sheets.Count)

Worksheets("Template").Copy after:=Worksheets(Worksheets.Count)

If Err.Description < "" Then Exit Sub
Err.Description = ""
newName = cell.Text
ActiveSheet.Name = newName
If Err.Description < "" Then
'--failed to rename, probably sheetname already exists...
xx = MsgBox("Failed to rename inserted worksheet " & _
vbLf & _
ActiveSheet.Name & " to " & newName & vbLf & _
Err.Number & " " & Err.Description, vbOKCancel, _
"Failed to Rename Worksheet, it will be deleted:")
'--eliminate already created sheet that failed to be
renamed...
Application.DisplayAlerts = False
ActiveSheet.Delete
Application.DisplayAlerts = True
'--check for immediate cancellation...
If xx = vbCancel Then Exit Sub
Err.Description = ""
End If
Next cell
Application.ScreenUpdating = True
End Sub
Sub WeeklyTallyNames()
Sheets("Weekly Tally").Activate
k = 4
For Each w In Sheets
AgentName = w.Name
If nm < "Template" Then
Cells(3, k).Value = AgentName
k = k + 1
End If
Next
End Sub
Sub GenerateAgents()
Call TabsFromList
Call WeeklyTallyNames
End Sub

Thanks,

- Alden

 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How can you get a list of sheetnames? Jack Excel Programming 1 May 14th 07 02:53 PM
how to update Listbox of sheetnames if user changes sheetnames? tr00per Excel Programming 7 February 12th 06 08:03 AM
Skip cells with TAB/SHIFT+TAB but allow arrow keys/mouse selection of skipped cells Wescotte Excel Programming 1 June 6th 05 07:00 PM
read sheetnames with ADO farmer[_2_] Excel Programming 6 November 2nd 04 04:25 PM
can we copy the sheetnames too? Martyn Excel Programming 5 May 21st 04 10:52 AM


All times are GMT +1. The time now is 03:22 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"