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: 41
Default insert sheet and naming it

Thanks, this works perfectly.

Greetings Hans


"Tom Ogilvy" schreef in bericht
...
Left off the last part

Dim sh as Worksheet, sName as String
Dim MaxWeek as Long, MaxIndex as Long

MaxWeek = 0
MaxIndex = 0
for each sh in ActiveWorkbook.Sheets
sName = sh.name
if isnumeric(sName) then
if clng(sName) < 53 then
if clng(sName) MaxWeek then
MaxWeek = clng(sName)
MaxIndex = sh.Index
end if
End if
end if
Next
Worksheets.Add(After:=worksheets(MaxIndex)).Name _
= cStr(MaxWeek + 1)
worksheets("54").Cells.copy worksheets(cStr(MaxWeek + 1))


--
Regards,
Tom Ogilvy



"Tom Ogilvy" wrote in message
...
Dim sh as Worksheet, sName as String
Dim MaxWeek as Long, MaxIndex as Long

MaxWeek = 0
MaxIndex = 0
for each sh in ActiveWorkbook.Sheets
sName = sh.name
if isnumeric(sName) then
if clng(sName) < 53 then
if clng(sName) MaxWeek then
MaxWeek = clng(sName)
MaxIndex = sh.Index
end if
End if
end if
Next
Worksheets.Add(After:=worksheets(MaxIndex)).Name _
= cStr(MaxWeek + 1)


--
Regards,
Tom Ogilvy


"hans" wrote in message
...
I have a workbook containing the workrosters for each week.
the sheets are named 1,2,3,4, etc (This are the week numbers)
Sheet 54 is the original sheet from witch i copy.
Other sheets have normal names like "tijden", "medewerkers", etc etc

If my last rostersheet is named 9, i would like to know how to insert a

new
sheet called 10 after 9.

I would like a vba solution.
Can someone help.

Greetings Hans








 
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
naming cells using insert name define Educating Rita Excel Worksheet Functions 2 March 30th 07 09:12 PM
naming sheet tab artist4christ Excel Worksheet Functions 5 January 17th 07 11:54 PM
Naming Sheet mehare Excel Discussion (Misc queries) 4 August 14th 06 06:20 PM
Sheet naming Pat Excel Programming 7 December 15th 04 10:29 PM
Naming a new sheet. Rich Cooper Excel Programming 1 May 25th 04 09:56 PM


All times are GMT +1. The time now is 10: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"