Hi, I am relatively new to Excel VBA and I am trying to create a personal template for my work. I already have the below code to insert a new sheet. But I don't know how to change the tab color based on a fixed cell value.
Sub GenerateConf()
On Error GoTo MyError
Sheets.Add
ActiveSheet.Name = WorksheetFunction.Text(Now(), "mm.dd.yyyy" + " OA ")
Exit Sub
MyError:
MsgBox "There is already a sheet called that."
End Sub
Cell J22 contains the letters OA. I want to be able to insert a new sheet, rename it to the current date + the letters OA + the count of sheets with OA as part of its name on the same day (like (date today) OA 1; (date today) OA 2; (date today) OA 3, etc) and then change the tab color to light green.
Any ideas?
Sub GenerateConf()
On Error GoTo MyError
Sheets.Add
ActiveSheet.Name = WorksheetFunction.Text(Now(), "mm.dd.yyyy" + " OA ")
Exit Sub
MyError:
MsgBox "There is already a sheet called that."
End Sub
Cell J22 contains the letters OA. I want to be able to insert a new sheet, rename it to the current date + the letters OA + the count of sheets with OA as part of its name on the same day (like (date today) OA 1; (date today) OA 2; (date today) OA 3, etc) and then change the tab color to light green.
Any ideas?