Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 18
Default Changing color of tabs

I have a macro that I want to change the color of the tabs ( I think it is
tab in english, I am referring to the small part of the worksheet that
displays the name etc..). When writing the code I want to select a number of
tabs and then change their color instead of writing code for every one of
them. However I dont know how to write it.

Private Sub Workbook_Open()
Sheets(Array("Tracking Error", "Mod Dur", "Indata")).Select
With Selection.Tab
.ColorIndex = 4
End With

My code does not work. I do not want to record a macro since I want to
change it later...Please help me!

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 30
Default Changing color of tabs

I couldn't tell you how to code that but I do know that you can normally
still edit macros after recording them. And it can be a really good way of
learning how to use VBA for Excel.

"Fabrizio" wrote:

I have a macro that I want to change the color of the tabs ( I think it is
tab in english, I am referring to the small part of the worksheet that
displays the name etc..). When writing the code I want to select a number of
tabs and then change their color instead of writing code for every one of
them. However I dont know how to write it.

Private Sub Workbook_Open()
Sheets(Array("Tracking Error", "Mod Dur", "Indata")).Select
With Selection.Tab
.ColorIndex = 4
End With

My code does not work. I do not want to record a macro since I want to
change it later...Please help me!

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,646
Default Changing color of tabs

Hi Fabrizio,

Unfortunately you can set tab color only one by one:
Private Sub Workbook_Open()
Set sharr = Sheets(Array("Tracking Error", "Mod Dur", "Indata"))
For Each wsh In sharr
wsh.Tab.ColorIndex = 4
Next wsh
End Sub

Regards,
Stefi

€˛Fabrizio€¯ ezt Ć*rta:

I have a macro that I want to change the color of the tabs ( I think it is
tab in english, I am referring to the small part of the worksheet that
displays the name etc..). When writing the code I want to select a number of
tabs and then change their color instead of writing code for every one of
them. However I dont know how to write it.

Private Sub Workbook_Open()
Sheets(Array("Tracking Error", "Mod Dur", "Indata")).Select
With Selection.Tab
.ColorIndex = 4
End With

My code does not work. I do not want to record a macro since I want to
change it later...Please help me!

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default Changing color of tabs

Damon is right, I went into a work book and recorded a macro doing what you
want to do and then wen in to edit. The code you need is as follows:

Sheets("Sheet1").Select
ActiveWorkbook.Sheets("Sheet1").Tab.ColorIndex = 36
--
Michal Joyce
Project Management IS Analyst
Aflac - Project Management Office


"Damon" wrote:

I couldn't tell you how to code that but I do know that you can normally
still edit macros after recording them. And it can be a really good way of
learning how to use VBA for Excel.

"Fabrizio" wrote:

I have a macro that I want to change the color of the tabs ( I think it is
tab in english, I am referring to the small part of the worksheet that
displays the name etc..). When writing the code I want to select a number of
tabs and then change their color instead of writing code for every one of
them. However I dont know how to write it.

Private Sub Workbook_Open()
Sheets(Array("Tracking Error", "Mod Dur", "Indata")).Select
With Selection.Tab
.ColorIndex = 4
End With

My code does not work. I do not want to record a macro since I want to
change it later...Please help me!

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default Changing color of tabs

As previously given

Dim sh As Object

Sheets(Array("Sheet1", "Sheet2", "Sheet3")).Select
For Each sh In ActiveWindow.SelectedSheets
sh.Tab.ColorIndex = 3
Next sh


--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"Fabrizio" wrote in message
...
I have a macro that I want to change the color of the tabs ( I think it is
tab in english, I am referring to the small part of the worksheet that
displays the name etc..). When writing the code I want to select a number

of
tabs and then change their color instead of writing code for every one of
them. However I dont know how to write it.

Private Sub Workbook_Open()
Sheets(Array("Tracking Error", "Mod Dur", "Indata")).Select
With Selection.Tab
.ColorIndex = 4
End With

My code does not work. I do not want to record a macro since I want to
change it later...Please help me!



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Run Macro when changing tabs Supe Excel Discussion (Misc queries) 2 December 31st 08 10:51 PM
Changing color of tabs Fabrizio Excel Programming 3 June 29th 06 12:30 PM
CANNOT COLOR MY WORKSHEET TABS, TAB COLOR NOT IN FORMAT pippa3art Excel Worksheet Functions 6 February 24th 06 11:24 PM
My excel 2003 wont let me fill cells with color or color the tabs. trizog New Users to Excel 2 February 22nd 05 06:43 PM
Macro for changing tabs Chip Pearson Excel Programming 5 February 12th 04 08:17 PM


All times are GMT +1. The time now is 05:31 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"