Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
N+ N+ is offline
external usenet poster
 
Posts: 34
Default color formatting from vbe

hi all.. i need to make the macro to format all the cells of my workbook like
this...

if cell is equal to 2 then
paint it red
end if

if cell is equal to 1 then
paint it blue
end if

help me !! byyy
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default color formatting from vbe

You could use Conditional Formatting, but with VBA:

Sub color_them()
For Each r In ActiveSheet.UsedRange
v = r.Value
If v = 1 Then
r.Interior.ColorIndex = 3
Else
If v = 2 Then
r.Interior.ColorIndex = 5
End If
End If
Next
End Sub

--
Gary''s Student - gsnu200788


"N+" wrote:

hi all.. i need to make the macro to format all the cells of my workbook like
this...

if cell is equal to 2 then
paint it red
end if

if cell is equal to 1 then
paint it blue
end if

help me !! byyy

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
Color formatting Spancek Excel Worksheet Functions 1 November 21st 07 01:55 PM
Color formatting with VBA Corey Excel Programming 2 August 17th 06 12:44 AM
Color Formatting Todd Nelson Excel Discussion (Misc queries) 8 April 3rd 06 10:37 PM
Conditional color formatting entries have wild color. John Geyer Excel Discussion (Misc queries) 0 February 24th 06 06:11 PM
Color Formatting Rick Brown Excel Programming 1 October 30th 04 12:44 AM


All times are GMT +1. The time now is 12:26 AM.

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

About Us

"It's about Microsoft Excel"