Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1
Default Text and Today() function in VBA

Here is a piece of my code. It will not compile.
I want SDate to be a text string in the format of "8/10/06 00:00:00 AM"

and EDate "8/10/06 11:59:59 PM". I preffered if this values were
yesterday's dates, but they have to change daily. Any suggestions?
Thanks.

My Code:


Dim SDate As String
Dim EDate As String


Set SDate = "TEXT(Month(TODAY())&" / "&DAY(TODAY())&" / "&Year(today())

& ""00:00:00 AM"""
Set SDate = "TEXT(Month(TODAY())&" / "&DAY(TODAY())&" / "&Year(today())

& ""11:59:59 PM"""

  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 11,058
Default Text and Today() function in VBA

Sub ppena()
Dim s As String
s = Now()
s2 = Split(s, " ")
sDate = s2(0) & " 00:00:00 AM"
eDate = s2(0) & " 11:59:59 PM"
MsgBox (sDate)
MsgBox (eDate)
End Sub

--
Gary's Student


" wrote:

Here is a piece of my code. It will not compile.
I want SDate to be a text string in the format of "8/10/06 00:00:00 AM"

and EDate "8/10/06 11:59:59 PM". I preffered if this values were
yesterday's dates, but they have to change daily. Any suggestions?
Thanks.

My Code:


Dim SDate As String
Dim EDate As String


Set SDate = "TEXT(Month(TODAY())&" / "&DAY(TODAY())&" / "&Year(today())

& ""00:00:00 AM"""
Set SDate = "TEXT(Month(TODAY())&" / "&DAY(TODAY())&" / "&Year(today())

& ""11:59:59 PM"""


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
Text does not display Tim Excel Discussion (Misc queries) 2 June 17th 06 03:47 AM
TODAY function question... Bob_BLC Excel Worksheet Functions 4 March 24th 06 03:37 PM
text spilling over text and colums flutterby Excel Discussion (Misc queries) 2 January 11th 06 02:29 PM
Date & Time mully New Users to Excel 4 May 23rd 05 11:56 AM
TODAY function? strazz Excel Worksheet Functions 3 February 19th 05 05:57 PM


All times are GMT +1. The time now is 08:36 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"