Sub routine to test and color cells
Closed
Ian
-
Aug 26, 2009 at 09:19 AM
venkat1926 Posts 1863 Registration date Sunday June 14, 2009 Status Contributor Last seen August 7, 2021 - Aug 27, 2009 at 08:17 PM
venkat1926 Posts 1863 Registration date Sunday June 14, 2009 Status Contributor Last seen August 7, 2021 - Aug 27, 2009 at 08:17 PM
Related:
- Sub routine to test and color cells
- Notepad++ background color - Guide
- Sound card color code - Guide
- Rg45 color coding - Guide
- Powertoys color picker download - Download - Other
- Html text color - Guide
2 responses
venkat1926
Posts
1863
Registration date
Sunday June 14, 2009
Status
Contributor
Last seen
August 7, 2021
811
Aug 26, 2009 at 08:13 PM
Aug 26, 2009 at 08:13 PM
your data is from A1 down in column A
try this macro ( modify to suit you)
try this macro ( modify to suit you)
Sub test() Dim rng As Range, c As Range Set rng = Range(Range("A1"), Cells(Rows.Count, "A").End(xlUp)) For Each c In rng If c <> "" And c <> 1 Then c.Interior.ColorIndex = 3 Next c End Sub
venkat1926
Posts
1863
Registration date
Sunday June 14, 2009
Status
Contributor
Last seen
August 7, 2021
811
Aug 27, 2009 at 08:17 PM
Aug 27, 2009 at 08:17 PM
I do not understand this did not work. What do you mean that it stops at C<> line.
it works i n my computer
one moe thing in your first message said that "if the cell is empty leave". but the cell is not empty but has zero(0) in the cell.
so change
c<>""
into
c<>0
check again
it works i n my computer
one moe thing in your first message said that "if the cell is empty leave". but the cell is not empty but has zero(0) in the cell.
so change
c<>""
into
c<>0
check again
Aug 27, 2009 at 07:57 AM
However I could not get it to go past the "If c <> line..."
This is a typical column
a
c
c
1
d
a
0
b
I only want to leave 1 and 0. All other answers )a,b,c,d) to be coloured red
Would this command be useful to determine the spreadsheet size i.e. avoid counting column by column?
Worksheets(1).Range("a1:k50")
Hope you can help, again!
Thanks
Ian