Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Colouring Cells

Status
Not open for further replies.

matpj

Technical User
Mar 28, 2001
687
GB
Hi,

is it possible to write a bit of VBA to look at the cells in a table, and colour empty cells one colour and cells with numebrs in another colour?

if so how is this done??

thanks,
Matt
 
You could try an if statement. Think the code below may help.

If IsEmpty(ActiveCell)) Then
ActiveCell.Select
Selection.Interior
.ColorIndex = 6
.Pattern = xlSolid

Else
ActiveCell.Select
Selection.Interior
.ColorIndex = 5
.Pattern = xlSolid


The colour index would make the activecell one colour if it is empty and another if it contains data.

Not sure if that is a help but it may be a start.

Let me know

dyarwood
 
presume you are using xl ???
don't need code - have a look at conditional formatting

Rgds, Geoff
[blue]Si hoc signum legere potes, operis boni in rebus Latinus alacribus et fructuosis potiri potes![/blue]
Want the [red]best[/red] answers to your questions ? faq222-2244
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top