Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default macro to colour empty cells (cells not recognized as empty)


Hello,

I have a problem marking cells on a worksheet,
the macro I made should colour the cell if it is empty or has a valu
1.

It only works for the cells that contain value 1, not for the empt
ones.
Probably it has to do with the fact that the all cells (including th
empty ones) are copied from other sheets,
and are not really seen as empty by the macro.

Here the Macro:

counter = 1
While counter <= 5
counter2 = 1
While counter2 <= 542
If ActiveCell = " " Then
With Selection.Interior
.ColorIndex = 3
.Pattern = xlSolid
End With
End If

If ActiveCell.Value <= 1 Then
With Selection.Interior
.ColorIndex = 3
.Pattern = xlSolid
End With
End If
counter2 = counter2 + 1
ActiveCell.Offset(rowOffset:=1, columnOffset:=0).Activate
Wend
counter = counter + 1
ActiveCell.Offset(rowOffset:=-542, columnOffset:=1).Activate
Wend

Can anybody help me with this issue?
Thanks in advance,
Gerbe

--
Gerbe
-----------------------------------------------------------------------
Gerben's Profile: http://www.excelforum.com/member.php...fo&userid=2478
View this thread: http://www.excelforum.com/showthread.php?threadid=38344

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 93
Default macro to colour empty cells (cells not recognized as empty)

Hi Gerben,
the thing is that empty cell value is not " " but "".

Sub recol()
For Each ccell In Selection
If ccell.Value = "" Then GoSub colorit
If ccell.Value = 1 Then GoSub colorit
Next
Exit Sub
colorit:
ccell.Interior.ColorIndex = 20
Return
End Sub

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default macro to colour empty cells (cells not recognized as empty)


Hi Roman,

the thing is that empty cell value is not " " but "" doesn't matter, as
i tried.

there should be something with the fact that the empty cells are copied
empty cells,

Any ideas?


--
Gerben
------------------------------------------------------------------------
Gerben's Profile: http://www.excelforum.com/member.php...o&userid=24780
View this thread: http://www.excelforum.com/showthread...hreadid=383447

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 93
Default macro to colour empty cells (cells not recognized as empty)

Hi Gerben,
are you sure the cells are really empty? Copying empty cells should not
affect anything. Empty cells are empty cells no matter where and how
many times copyied.
Check if there are not blank spaces in your cells as " " and "" is a
big difference.

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default macro to colour empty cells (cells not recognized as empty)


Roman

it had to be " 3spacebars " instead of "2spacebars "

The small things make the big differences

--
Gerbe
-----------------------------------------------------------------------
Gerben's Profile: http://www.excelforum.com/member.php...fo&userid=2478
View this thread: http://www.excelforum.com/showthread.php?threadid=38344



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 93
Default macro to colour empty cells (cells not recognized as empty)

It certainly does!
It also means that the cells were not empty but contained three spaces.

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
Macro to clean empty cells Dr Hackenbush[_2_] Excel Discussion (Misc queries) 0 March 9th 10 11:55 AM
Excel - Autom. Filter "Empty / Non Empty cells" should come first Rom Excel Discussion (Misc queries) 0 August 10th 05 04:32 PM
When I SUM cells & 1 is empty I need the result to be empty not 0 Maribel Excel Discussion (Misc queries) 1 August 2nd 05 12:49 AM
How can I convert empty strings to empty cells? Shane Excel Discussion (Misc queries) 2 July 19th 05 12:10 PM
Can blank cells created using empty Double-Quotes not be empty?? JohnI in Brisbane Excel Programming 6 September 7th 03 11:22 PM


All times are GMT +1. The time now is 01:44 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"