Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / Programming / May 2008

Tip: Looking for answers? Try searching our database.

color formatting from vbe

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
N+ - 24 May 2008 13:30 GMT
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
Gary''s Student - 24 May 2008 14:35 GMT
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

Signature

Gary''s Student - gsnu200788

> hi all.. i need to make the macro to format all the cells of my workbook like
> this...
[quoted text clipped - 8 lines]
>
> help me !! byyy
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.