code to input date after diff. cell selected

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

basically i want to insert a date in to one cell but only if i select another
cell... make sense??? i attempted the following but had no result considering
the Range("D3").... selects the cell... can anyone help
Sub Insert_Date()

If Range("D2").Select Then
cell = ("L4") = ""
Else
cell = ("L4") = "=TODAY()"
End If

End Sub
 
Not sure of the logic of what you are trying to achieve, but use the
Worksheet_SelectionChange event :

Private Sub Worksheet_SelectionChange(ByVal Target As Range)

If Target.Address = Range("D2").Address Then
Range("L4").Value = ""
Else
Range("L4").Formula = "=TODAY()"
'Or
'Range("L4").Formula = Now()
End If

End Sub

NickHK

Kelzina said:
basically i want to insert a date in to one cell but only if i select another
cell... make sense??? i attempted the following but had no result considering
the Range("D3").... selects the cell... can anyone help
Sub Insert_Date()

If Range("D2").Select Then
cell = ("L4") = ""
Else
cell = ("L4") = "=TODAY()"
End If

End Sub
will"
 
nevermind, my explanation is prolly to confusing, ill try something else,
thanx anyway
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top