Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
macro for conditional number formatting
Can anyone help me.
Im trying to write a macro where each time i enter text in column A it will conditionally format the number in the same row of column C ? The text that is entered in column A is limited to the list below. column A(TEXT) column C(format) ES (####.##) NQ (####.##) AB (####.##) YM (####.##) ZB (# #/32) EC (#.####) JY (###.##) ED (##.###) |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
macro for conditional number formatting
Scott,
Worksheet event code. Private Sub Worksheet_Change(ByVal Target As Range) Application.EnableEvents = False On Error GoTo ws_exit If Target.Column = 1 Then Select Case Target.Value Case "ES": Target.EntireRow.NumberFormat = "(####.##)" Case "NQ": Target.EntireRow.NumberFormat = "(####.##)" Case "AB": Target.EntireRow.NumberFormat = "(####.##)" Case "YM": Target.EntireRow.NumberFormat = "(####.##)" Case "ZB": Target.EntireRow.NumberFormat = "(# #/32)" Case "EC": Target.EntireRow.NumberFormat = " (#.####)" Case "JY": Target.EntireRow.NumberFormat = " (###.##)" Case "ED": Target.EntireRow.NumberFormat = " (##.###)" End Select End If ws_exit: Application.EnableEvents = True End Sub Put it in theworksheet code module - right click on the sheet name tab, View Code -- HTH Bob Phillips ... looking out across Poole Harbour to the Purbecks (remove nothere from the email address if mailing direct) "scott23" wrote in message om... Can anyone help me. Im trying to write a macro where each time i enter text in column A it will conditionally format the number in the same row of column C ? The text that is entered in column A is limited to the list below. column A(TEXT) column C(format) ES (####.##) NQ (####.##) AB (####.##) YM (####.##) ZB (# #/32) EC (#.####) JY (###.##) ED (##.###) |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
macro for conditional number formatting
How would i modify this so that instead of the entire row
being formatted, it would only be columns E/F/H/I Thanks -----Original Message----- Scott, Worksheet event code. Private Sub Worksheet_Change(ByVal Target As Range) Application.EnableEvents = False On Error GoTo ws_exit If Target.Column = 1 Then Select Case Target.Value Case "ES": Target.EntireRow.NumberFormat = "(####.##)" Case "NQ": Target.EntireRow.NumberFormat = "(####.##)" Case "AB": Target.EntireRow.NumberFormat = "(####.##)" Case "YM": Target.EntireRow.NumberFormat = "(####.##)" Case "ZB": Target.EntireRow.NumberFormat = "(# #/32)" Case "EC": Target.EntireRow.NumberFormat = " (#.####)" Case "JY": Target.EntireRow.NumberFormat = " (###.##)" Case "ED": Target.EntireRow.NumberFormat = " (##.###)" End Select End If ws_exit: Application.EnableEvents = True End Sub Put it in theworksheet code module - right click on the sheet name tab, View Code -- HTH Bob Phillips ... looking out across Poole Harbour to the Purbecks (remove nothere from the email address if mailing direct) "scott23" wrote in message . com... Can anyone help me. Im trying to write a macro where each time i enter text in column A it will conditionally format the number in the same row of column C ? The text that is entered in column A is limited to the list below. column A(TEXT) column C(format) ES (####.##) NQ (####.##) AB (####.##) YM (####.##) ZB (# #/32) EC (#.####) JY (###.##) ED (##.###) . |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
macro for conditional number formatting
See response to other question.
-- HTH Bob Phillips ... looking out across Poole Harbour to the Purbecks (remove nothere from the email address if mailing direct) "scott23" wrote in message ... How would i modify this so that instead of the entire row being formatted, it would only be columns E/F/H/I Thanks -----Original Message----- Scott, Worksheet event code. Private Sub Worksheet_Change(ByVal Target As Range) Application.EnableEvents = False On Error GoTo ws_exit If Target.Column = 1 Then Select Case Target.Value Case "ES": Target.EntireRow.NumberFormat = "(####.##)" Case "NQ": Target.EntireRow.NumberFormat = "(####.##)" Case "AB": Target.EntireRow.NumberFormat = "(####.##)" Case "YM": Target.EntireRow.NumberFormat = "(####.##)" Case "ZB": Target.EntireRow.NumberFormat = "(# #/32)" Case "EC": Target.EntireRow.NumberFormat = " (#.####)" Case "JY": Target.EntireRow.NumberFormat = " (###.##)" Case "ED": Target.EntireRow.NumberFormat = " (##.###)" End Select End If ws_exit: Application.EnableEvents = True End Sub Put it in theworksheet code module - right click on the sheet name tab, View Code -- HTH Bob Phillips ... looking out across Poole Harbour to the Purbecks (remove nothere from the email address if mailing direct) "scott23" wrote in message . com... Can anyone help me. Im trying to write a macro where each time i enter text in column A it will conditionally format the number in the same row of column C ? The text that is entered in column A is limited to the list below. column A(TEXT) column C(format) ES (####.##) NQ (####.##) AB (####.##) YM (####.##) ZB (# #/32) EC (#.####) JY (###.##) ED (##.###) . |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Need help with macro for conditional formatting using number forma | Excel Worksheet Functions | |||
whole number conditional formatting | Excel Worksheet Functions | |||
Whole Number Conditional Formatting | Excel Discussion (Misc queries) | |||
Conditional Number Formatting | Excel Discussion (Misc queries) | |||
odd and even number conditional formatting | Excel Discussion (Misc queries) |