Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Can anybody modify macro below to make it continue running even if it
can't rename a worksheet (sheetname can't take cell content) i.e rename all other sheets. Sub Renamesheetloop() For Each ws In Worksheets ws.Name = ws.Range("A1").Value Next ws End Sub Thxs |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Sub Renamesheetloop()
For Each ws In Worksheets on error resume next ws.Name = ws.Range("A1").Value on error goto 0 Next ws End Sub or Sub Renamesheetloop() For Each ws In Worksheets on error resume next ws.Name = ws.Range("A1").Value if err.number = 0 then 'ok else msgbox "rename of sheet: " & ws.name & " failed" err.clear end if on error goto 0 Next ws End Sub wrote: Can anybody modify macro below to make it continue running even if it can't rename a worksheet (sheetname can't take cell content) i.e rename all other sheets. Sub Renamesheetloop() For Each ws In Worksheets ws.Name = ws.Range("A1").Value Next ws End Sub Thxs -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
macro to execute code on all worksheets in workbook | Excel Programming | |||
Error on opening more than one workbook containing the same code | Excel Programming | |||
error code while opening a workbook | Excel Programming | |||
Error in VBA code to save workbook | Excel Programming | |||
Run code for multiple worksheets in a workbook & Column Formatting | Excel Programming |