You'll have to change the prompt. The characters got mangled in the post.
Maybe something like:
Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Cells.Count > 1 Then Exit Sub
If Intersect(Target, Me.Range("B3:C3")) Is Nothing Then
Exit Sub
End If
Me.Range("p_1").NumberFormat = "dd-MM-yy hh:mm"
Me.Range("k_1").NumberFormat = "dd-MM-yy hh:mm"
If Not (Intersect(Target, Me.Range("b3")) Is Nothing) Then
'in B3
With Me.Range("p_1")
If .Value = 0 _
Or .Value = "" Then
Application.EnableEvents = False
.Value = InputBox("yourPrompthere")
Application.EnableEvents = True
End If
End With
Else
'must be in C3
With Me.Range("k_1")
If .Value = 0 _
Or .Value = "" Then
Application.EnableEvents = False
.Value = InputBox("yourPrompthere")
Application.EnableEvents = True
End If
End With
End If
End Sub
SolAr wrote:
>
> Hi,
> the format of cell p_1 is "dd-mm-yy hh:mm"
>
> this procedure running inputbox:
>
> Private Sub Worksheet_Change(ByVal Target As Range)
> Dim row As Integer
> Range("p_1").Select
> With ActiveCell.NumberFormat = "dd-MM-yy hh:mm"
> End With
> If Target.row = 3 And Target.Column = 2 And Range("p_1").Value = "" Or
> Range("p_1").Value = 0 Then _
> : Range("p_1").Value = InputBox("Wpisz datę" & vbNewLine & vbNewLine &
> "Początkową" & vbNewLine & vbNewLine & "Delegacji PL:")
> Range("K_1").Select
> With ActiveCell.NumberFormat = "dd-MM-yy h:mm"
> End With
> If Target.row = 3 And Target.Column = 3 And Range("K_1").Value = "" Or
> Range("K_1").Value = 0 Then _
> : Range("K_1").Value = InputBox("Wpisz datę" & vbNewLine & vbNewLine &
> "Końcową" & vbNewLine & vbNewLine & "Delegacji PL:")
> End Sub
>
> !!! however, input box changing format of cell p_1 to "mm-dd-yy hh:mm" !!!
>
> what should I declare, to write correctly date in cell p_1 ???
>
> thx in advance
> Artur
--
Dave Peterson
|