Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi All
I can't work out why my code is not working here? I need to find a worksheet, rename and hide it before I can run the next code... The code needs to: - Find any worksheet names starting from the left with the following 20 characters: "booking form revised" (any hidden sheets can be ignored) - If it doesn't find any worksheets with this name then skip the rest of the macro and call "RevisedMBA" - If it does find a worksheet - Rename that worksheet to: "Old BKF chgd " & x (x = WorksheetFunction.Text(Now(), "dd-mm-yy at hhmm") I know that I'm limited to 31 characters in a worksheet name - I've kept under that - just with 29. - Hide the renamed "Old BKF chgd " & x worksheet - Now call RevisedMBA. Current Code: _________________________________ Sub Checksheets() Dim Flag As Integer x = WorksheetFunction.Text(Now(), "dd-mm-yy at hhmm") Flag = 0 For Each sh In Worksheets If Left(sh.Name, 20) = "Booking Form Revised" Then Sheets("Booking Form Revised").Name = "Old BKF chgd " & x Flag = Flag + 1 sh.Visible = xlSheetHidden End If Next If Flag = 0 Then Call RevisedMBA End If End Sub _____________________ -- Thank for your help BeSmart |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
rename the new worksheet | Excel Programming | |||
problem after rename of file | Excel Discussion (Misc queries) | |||
Copy worksheet, rename, merged cell problem?? | Excel Programming | |||
Using information from one worksheet, to rename inserted worksheet | Excel Worksheet Functions | |||
HOW DO I DELETE A WORKSHEET IN EXCEL? NOT HIDE IT OR RENAME IT | Excel Worksheet Functions |