How to change all cells with "zero" value into transparent, not bl

A

AlanSimpson

Hi, HELP!!! how to write code to change all cells with "zero" value into
transparent, "not blank",
I got the following from the Excel macro recorder, but it does not work, for
me :)


Sub Macro1()
'
' Macro1 Macro
'
'
Range("A1:AA1000").Select
Selection.FormatConditions.Delete
Selection.FormatConditions.Add Type:=xlCellValue, Operator:=xlEqual, _
Formula1:="0"
With Selection.FormatConditions(1).Font
.Bold = False
.Italic = False
.ColorIndex = 2
End With
End Sub
 
G

Gary Keramidas

this may work for you

Sub test()
Dim rng As Range
Dim rngfound As Range
Application.ScreenUpdating = fasle
Application.Calculation = xlCalculationManual
Set rng = Range("A1:AA1000")
With rng
Set rngfound = .Find(What:="0", lookIn:=xlValues, LookAt:=xlWhole, _
searchorder:=xlByRows)
On Error Resume Next
If Not rngfound Is Nothing Then
firstaddress = rngfound.Address
Do
With rngfound
.Font.Bold = False
.Font.ColorIndex = 2
End With

Set rngfound = .FindNext(rngfound)
Loop While Not rngfound Is Nothing And rngfound.Address <> _
firstaddress
End If
End With
Application.ScreenUpdating = True
Application.Calculation = xlCalculationAutomatic
End Sub
 
G

Gary Keramidas

don't know anything about foxpro

--


Gary


AlanSimpson said:
Hi, Gary, thanks a lot. Could you make it work under Foxpro 5.0
environment ?


"Gary Keramidas" ??:
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top