Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
naming cells using insert name define | Excel Worksheet Functions | |||
naming sheet tab | Excel Worksheet Functions | |||
Naming Sheet | Excel Discussion (Misc queries) | |||
Sheet naming | Excel Programming | |||
Naming a new sheet. | Excel Programming |