Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi,
I would like to associate a particular format to a cell depending on the text contained by the cell next to it. so if for example cell A1 has date and time i would like to have a particular format in B1; if A2 has number of people i would kie to have in B2 an other type of format. is that possible? |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
One way
Private Sub Worksheet_Change(ByVal Target As Range) Const WS_RANGE As String = "H10" '<=== change to suit On Error GoTo ws_exit: Application.EnableEvents = False If Not Intersect(Target, Me.Range(WS_RANGE)) Is Nothing Then Select Case Target.Value Case 1: Target.Offset(0, 1).NumberFormat = "dd mmm yyyy" Case 2: Target.Offset(0, 1).NumberFormat = "#,##0.00" Case 3: Target.Offset(0, 1).NumberFormat = "#,##0" 'etc End Select End If ws_exit: Application.EnableEvents = True End Sub 'This is worksheet event code, which means that it needs to be 'placed in the appropriate worksheet code module, not a standard 'code module. To do this, right-click on the sheet tab, select 'the View Code option from the menu, and paste the code in. -- HTH Bob Phillips (replace somewhere in email address with gmail if mailing direct) "massi" wrote in message ... Hi, I would like to associate a particular format to a cell depending on the text contained by the cell next to it. so if for example cell A1 has date and time i would like to have a particular format in B1; if A2 has number of people i would kie to have in B2 an other type of format. is that possible? |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Associate Data Across Rows | Excel Discussion (Misc queries) | |||
How can I associate a formula with Checkboxes | Excel Discussion (Misc queries) | |||
ASSOCIATE number TO VALUE | Excel Discussion (Misc queries) | |||
associate color | Excel Discussion (Misc queries) | |||
Associate name with email | Excel Discussion (Misc queries) |