ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   How to create a conditional format that changes the number format (https://www.excelbanter.com/excel-discussion-misc-queries/106576-how-create-conditional-format-changes-number-format.html)

tmbo

How to create a conditional format that changes the number format
 

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.


--
tmbo
------------------------------------------------------------------------
tmbo's Profile: http://www.excelforum.com/member.php...o&userid=37214
View this thread: http://www.excelforum.com/showthread...hreadid=574469


Muhammed Rafeek M

How to create a conditional format that changes the number format
 
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"


"tmbo" wrote:


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.


--
tmbo
------------------------------------------------------------------------
tmbo's Profile: http://www.excelforum.com/member.php...o&userid=37214
View this thread: http://www.excelforum.com/showthread...hreadid=574469




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

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com