View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
SYBS SYBS is offline
external usenet poster
 
Posts: 31
Default Sheet creation and colouring the tabs

I have a workbook which creates and names extra sheets dependant upon the
list of names entered on the Set Up Sheet. (Range B16:B20). These sheets
will always be Sheets 3 - 7, but not all of them will always be in use (If
for instance there are only 3 names entered and not 5), sheets 6 and 7 wont
be used on that occasion.

Managed to happily get this working in terms of the number created and
naming of those sheets , but I need to colour code the tabs of the new
sheets. I have tried

Set CompCell1 = Worksheet("Set Up").Range (B16) - and so on down to CompCell5

If not IsEmpty (CompCell1) then
Worksheets(Sheet3.Name).Tab.ColourIndex = 6

I have also tried

If Worksheets.Name = Worksheets(Sheet3.Name) then
Worksheets(Sheet3.Name).Tab.ColourIndex = 6

I have had various error messages including object not supported.

I think I am getting mixed up with how I should refer to the sheets, but I
cant use the Tab names allocated from the entered list because I want this
workbook to be reused many times for different competitions, so have tried to
use their original names to miss that problem. I also am unsure of what type
of sub to use and dont really understand the differences too well, and where
to put it.

It's a really slow process getting the head around VBA but any help from
anyone would be appreciated, I am hoping to learn as I go on.

Thanks in advance

Sybs