tonywatsonhelp
Well-known Member
- Joined
- Feb 24, 2014
- Messages
- 3,212
- Office Version
- 365
- 2019
- 2016
- Platform
- Windows
Hi Everyone,
I have a macro that simple copys tabs into there own sheet, (I'll leave a copy below)
But when it create these new tabs, the colour is different to the colour I have and it turns out it because its defaulting to Office colours instead of Office 2013 -2022
I then have to mgo back in and change this and save it. (As the actor said to the actress "This has never happened to me before!"
so two question
One any idea why?
two and more importantly
can I add something to this macro that macks the new workbook set as Office 2013 -2022?
Thanks
Tony
I have a macro that simple copys tabs into there own sheet, (I'll leave a copy below)
But when it create these new tabs, the colour is different to the colour I have and it turns out it because its defaulting to Office colours instead of Office 2013 -2022
I then have to mgo back in and change this and save it. (As the actor said to the actress "This has never happened to me before!"
so two question
One any idea why?
two and more importantly
can I add something to this macro that macks the new workbook set as Office 2013 -2022?
Thanks
Tony
VBA Code:
Sub CopySheetsWithTabColor()
Dim ws As Worksheet
Dim newWorkbook As Workbook
Dim tabName As String
Dim savePath As String
Dim currentWorkbookPath As String
currentWorkbookPath = ThisWorkbook.Path & "\"
For Each ws In ThisWorkbook.Worksheets
If ws.Tab.Color = RGB(68, 114, 196) Then
tabName = ws.Name
ws.Copy
ActiveWorkbook.SaveAs Filename:= _
currentWorkbookPath & "Hershey-" & tabName & " Supplier Summary EPI 2024.xlsx"
ActiveWorkbook.Close SaveChanges:=False
End If
Next ws
MsgBox "Sheets with the specified tab color have been copied and saved.", vbInformation
End Sub