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" <(E-Mail Removed)> wrote in message
news:B188C5EB-ECA9-4FA3-A631-(E-Mail Removed)...
> 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?
|