I have 2 macros that use the same code to rename a sheet and a new workbook using a date format string but it is now throwing a wobbly after working for nearly 18 months. Error message comes up that it can't compile as it cannot find project or library. I checked the VBA library and the Format.
Here is my full code for copying and renaming a worksheet based on a date in cell C19.
I have have tried repairing Office 2003, I have uninstalled & reinstalled offce 2003, I went back to an earlier restore point on XP prof SP3 with regular`updates.
I have checked the object browser for the the term "Format" and it is there.
I have tried deleting the line & rewriting it etc. still no joy!!!!!
Any suggestions?
TIA
Still no joy.
Here is my full code for copying and renaming a worksheet based on a date in cell C19.
Code:
Sub CopySheetAs()
'This macro developed for timesheet
Dim shtname, Dt, Dt2, shtname2 As String
Dim a As Worksheet
Set a = ActiveSheet
Dim sCt As Integer
sCt = ActiveWorkbook.Sheets.Count
ActiveSheet.Copy Before:=Sheets(1)
'Adds a week to start of week date
ActiveSheet.Range("C19").Value = Range("C19").Value + 7
'Creates date format for new sheet name
[B][COLOR=#0000ff]Dt = Format(Range("C19").Value + 6, "DDMMYYYY")[/COLOR][/B] :(:(:(
shtname = "WE " & Dt
ActiveSheet.Name = shtname
Rows("19:36").Select
Range("K20").Activate
Selection.EntireRow.Hidden = False
'Creates week before date to be able to _
'move current activeSht to beginning
Dt2 = Format(Range("C25").Value - 7, "DDMMYYYY")
shtname2 = "WE " & Dt2
'a.Move after:=Sheets(shtname2)
End Sub
I have have tried repairing Office 2003, I have uninstalled & reinstalled offce 2003, I went back to an earlier restore point on XP prof SP3 with regular`updates.
I have checked the object browser for the the term "Format" and it is there.
I have tried deleting the line & rewriting it etc. still no joy!!!!!
Any suggestions?
TIA
Still no joy.
Last edited: