How to create a conditional format that changes the number format

T

tmbo

Hi

I am wondering if it is possible to change the number format of a
column of values depending on a cell that says true or false.

I would like to be able to specify it like a conditional fromat.

I know you can do something in custom number format but as far as I
know this will only evaluate the condition on the current cell value.

Any help would be most appreciated.
 
G

Guest

write small code in a particular worksheet module:

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "$D$10" And Target.Value = 20 Then
Target.NumberFormat = "00.00"
Else
Target.NumberFormat = "00"
End If
End Sub

'Target.Address = "$D$10" And Target.Value = 20 - example cell address $D$10
and value 10
'example format: Target.NumberFormat = "00.00"
 

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