Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 115
Default What variable would I use to aquire Today()

I have this working except that I want 09/19/05 to equal Today()'s date
What would this line need to look like?
Range("Q4") = "09/19/05"

------------
If Target.Address = "$P$4" Then
If Range("Q4") = "mm/dd" Then
Range("Q4") = "09/19/05"
Range("C12").Select
Else
Range("Q4") = "mm/dd"
Range("Q4").Select
End If
End If
------------

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default What variable would I use to aquire Today()

With Range("Q4")
.value = date
.numberformat = "mm/dd/yy"
end with



CRayF wrote:

I have this working except that I want 09/19/05 to equal Today()'s date
What would this line need to look like?
Range("Q4") = "09/19/05"

------------
If Target.Address = "$P$4" Then
If Range("Q4") = "mm/dd" Then
Range("Q4") = "09/19/05"
Range("C12").Select
Else
Range("Q4") = "mm/dd"
Range("Q4").Select
End If
End If
------------


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 115
Default What variable would I use to aquire Today()

Works like a champ... thanks

If Target.Address = "$P$4" Then
If Range("Q4") = "mm/dd" Then
With Range("Q4")
.Value = Date
.NumberFormat = "mm/dd/yy"
End With
Range("C12").Select
Else
Range("Q4") = "mm/dd"
Range("Q4").Select
End If
End If


"Dave Peterson" wrote:

With Range("Q4")
.value = date
.numberformat = "mm/dd/yy"
end with


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,651
Default What variable would I use to aquire Today()

On Mon, 19 Sep 2005 12:07:03 -0700, "CRayF"
wrote:

I have this working except that I want 09/19/05 to equal Today()'s date
What would this line need to look like?
Range("Q4") = "09/19/05"

------------
If Target.Address = "$P$4" Then
If Range("Q4") = "mm/dd" Then
Range("Q4") = "09/19/05"
Range("C12").Select
Else
Range("Q4") = "mm/dd"
Range("Q4").Select
End If
End If
------------


Probably you want to use the Date function:

Range("Q4") = Date


--ron
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 115
Default What variable would I use to aquire Today()

Thanks... All works great...
This is what I ended up with...
P4 starts out as a value of "T" and Q4 equals "<- Click"
When P4 ("T"oday) is selected , it places todays date in Q4 and changes P4
to a "C" for "Clear". When selected again ("C") then it replaces todays date
with "<- Click". and P4 back to "T". This toggles back and forth when
selected.
---------------
If Target.Address = "$P$4" Then
If Range("Q4") = "<- Click" Then
With Range("Q4")
Range("Q4") = Date
Range("P4") = "C"
End With
Range("C12").Select
Else
Range("Q4") = "<- Click"
Range("P4") = "T"
Range("Q4").Select
End If
End If
---------------------------

"Ron Rosenfeld" wrote:

On Mon, 19 Sep 2005 12:07:03 -0700, "CRayF"
wrote:

I have this working except that I want 09/19/05 to equal Today()'s date
What would this line need to look like?
Range("Q4") = "09/19/05"

------------
If Target.Address = "$P$4" Then
If Range("Q4") = "mm/dd" Then
Range("Q4") = "09/19/05"
Range("C12").Select
Else
Range("Q4") = "mm/dd"
Range("Q4").Select
End If
End If
------------


Probably you want to use the Date function:

Range("Q4") = Date


--ron



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
Today variable to calender control anonymous Excel Discussion (Misc queries) 2 March 10th 05 03:22 PM
Sub to aquire list of worksheets aking1987[_9_] Excel Programming 4 November 17th 04 05:27 PM
Sub to aquire list of worksheets aking1987[_14_] Excel Programming 3 November 17th 04 04:37 PM
Sub to aquire list of worksheets aking1987[_11_] Excel Programming 3 November 17th 04 03:57 PM
Sub to aquire list of worksheets aking1987[_13_] Excel Programming 0 November 17th 04 03:44 PM


All times are GMT +1. The time now is 11:29 PM.

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

About Us

"It's about Microsoft Excel"