View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
K Dales[_2_] K Dales[_2_] is offline
external usenet poster
 
Posts: 1,163
Default Value to be given to all cells with black background color

Dim ThisCell as Range
For Each ThisCell in Selection.Cells
If ThisCell.Interior.Color = vbBlack Then ThisCell.Value = 1
Next ThisCell

"Norbert Jaeger" wrote:

Hello,

I have a certain range of cells in which some of the cells are
formatted to have a black background color.
None of the cells contain any data.

I want to select the whole range of cells and then run a macro which
puts a "1" into each black cell. The white cells must stay empty.

How can I do this?

Regards,
Norbert