Hi all,
I have a slight issue that I can't get my head round. I haven't done much of this just a bit of playing in excel.
There is some VBA code on a worksheet that changes the tab colour dependent of some cell values, this works ok.
If I copy and rename the worksheet, the code still changes the tab colour.
But if I use the following code to copy and rename the sheet from a button the code to change the tab stops working.
Sub Button410_Click() ' Create Timesheet
Dim NewName, Exists
NewName = Range("T3").Value
Exists = False
For Each ws In Worksheets
If ws.Name = NewName Then
Exists = True
Exit For
End If
Next
If Exists = False Then
Worksheets("XXX WkX Time").Copy Before:=Worksheets("Add Sheet")
Range("N10").Value = NewName
Worksheets("XXX WkX Time (2)").Name = NewName
ActiveSheet.Tab.ColorIndex = 3
Worksheets("Add Sheet").Activate
Else
MsgBox "Worksheet - " & NewName & " - Allready Exists"
End If
End Sub
Any ideas??
Thanks
Bookmarks