Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default code to input date after diff. cell selected

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
--
"The difference between Possible and Impossible is the measure of ones will"
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,391
Default code to input date after diff. cell selected

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" wrote in message
...
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
--
"The difference between Possible and Impossible is the measure of ones

will"


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default code to input date after diff. cell selected

nevermind, my explanation is prolly to confusing, ill try something else,
thanx anyway
--
"The difference between Possible and Impossible is the measure of ones will"


"NickHK" wrote:

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" wrote in message
...
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
--
"The difference between Possible and Impossible is the measure of ones

will"



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
vb code to copy and list selected row to diff sheets pvkutty Excel Discussion (Misc queries) 1 February 17th 10 12:05 PM
Automatically input a symbol in a selected cell mapesii Excel Discussion (Misc queries) 3 March 14th 09 05:11 AM
Code to Query SQL Server with a parameter value (entered into an Input Box), and have that value also display in a selected cell on a worksheet Doctorjones_md Excel Discussion (Misc queries) 3 June 27th 07 04:14 PM
Code to Query SQL Server with a parameter value (entered into an Input Box), and have that value also display in a selected cell on a worksheet Doctorjones_md Excel Worksheet Functions 3 June 27th 07 04:14 PM
calculate date diff in a cell Brian Shafer[_2_] Excel Programming 4 January 3rd 06 12:39 PM


All times are GMT +1. The time now is 03:21 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"