Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Dave
 
Posts: n/a
Default How to auto number cells that have colour

Hi

I would like to auto number cells that have only a light yellow colour.
In Row C sheet1 I have numbers starting from 0001 etc, some cells in the
column do not have light yellow these remain blank.
So if a Row C cell becomes light yellow i would like the next number to be
added.

Thanks in Advance


  #2   Report Post  
Ken Wright
 
Posts: n/a
Default

You need to use VBA to do this. Try something like this:-

Select the range from start to finish and then run this code - assumes your
cells are either coloured or not, and that if they are then they get
numbered.


Sub NumberColour()
Dim ActSht As Worksheet
Dim cel As Range
Set ActSht = ActiveSheet

ActSht.Columns("C:C").NumberFormat = "0000"
cntr = 1

For Each cel In Selection
If Not cel.Interior.ColorIndex = xlNone Then
cel.Value = cntr
cntr = cntr + 1
End If
Next cel
End Sub


Regards
Ken....................

"Dave" wrote in message
...
Hi

I would like to auto number cells that have only a light yellow colour.
In Row C sheet1 I have numbers starting from 0001 etc, some cells in the
column do not have light yellow these remain blank.
So if a Row C cell becomes light yellow i would like the next number to be
added.

Thanks in Advance



  #3   Report Post  
Dave
 
Posts: n/a
Default

Thanks Ken



"Ken Wright" wrote in message
...
You need to use VBA to do this. Try something like this:-

Select the range from start to finish and then run this code - assumes
your cells are either coloured or not, and that if they are then they get
numbered.


Sub NumberColour()
Dim ActSht As Worksheet
Dim cel As Range
Set ActSht = ActiveSheet

ActSht.Columns("C:C").NumberFormat = "0000"
cntr = 1

For Each cel In Selection
If Not cel.Interior.ColorIndex = xlNone Then
cel.Value = cntr
cntr = cntr + 1
End If
Next cel
End Sub


Regards
Ken....................

"Dave" wrote in message
...
Hi

I would like to auto number cells that have only a light yellow colour.
In Row C sheet1 I have numbers starting from 0001 etc, some cells in the
column do not have light yellow these remain blank.
So if a Row C cell becomes light yellow i would like the next number to
be added.

Thanks in Advance





  #4   Report Post  
paul
 
Posts: n/a
Default

you dont say on what condition the cells become coloured.You can use the same
reasoning to number the cells without a macro.If you have selected them
manually with no specific criteria then a macro is your only choice
You need a helper column which can be hidden
you have a column of numbers or letters in A:A
say you want to number only the numbers
in B1=IF(ISNUMBER(A1),1,0)
in b2=IF(ISNUMBER(A2),B1+1,B1) and copy down
Hide columnB:B
in C1=B1
in C2=IF(B2=B1,"",B2)
copy down


paul
remove nospam for email addy!



"Dave" wrote:

Hi

I would like to auto number cells that have only a light yellow colour.
In Row C sheet1 I have numbers starting from 0001 etc, some cells in the
column do not have light yellow these remain blank.
So if a Row C cell becomes light yellow i would like the next number to be
added.

Thanks in Advance



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
rating cells 1-5 colour coded HOW? treetop40 New Users to Excel 1 August 9th 05 12:03 PM
auto color blank cells ,best solution bigdaddy3 Excel Discussion (Misc queries) 1 August 3rd 05 05:21 PM
can I get cells with a minus number to show zero marcus1066 Excel Discussion (Misc queries) 3 May 7th 05 06:09 PM
how do i sought coloured number cells from normal ones? sjb1981 Excel Discussion (Misc queries) 1 April 1st 05 02:49 PM
assign auto number and auto date Krit Kasem Excel Discussion (Misc queries) 2 January 14th 05 02:55 AM


All times are GMT +1. The time now is 09:04 AM.

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

About Us

"It's about Microsoft Excel"