Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
max max is offline
external usenet poster
 
Posts: 12
Default Using DateAdd with a text string

I have a textbox that I am entering a date and want to do some date calculations on it

I have the following but my suspician is this is returning a strin

Startdate = Format(UserForm1.TextBox1, "dd-mm-yyyy 00:00:00"

I tried the following but it there is a Type Mismatc

Startdate = DateAdd(m, -1, Format(UserForm1.TextBox1, "dd-mm-yyyy 00:00:00")

Do I need to do something else so this can be manipulated using DateAdd metho

Max
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Using DateAdd with a text string

Possibly:
Startdate = Format(cdate(UserForm1.TextBox1), "dd-mm-yyyy 00:00:00")

--
regards,
Tom Ogilvy

"Max" wrote in message
...
I have a textbox that I am entering a date and want to do some date

calculations on it.

I have the following but my suspician is this is returning a string

Startdate = Format(UserForm1.TextBox1, "dd-mm-yyyy 00:00:00")

I tried the following but it there is a Type Mismatch

Startdate = DateAdd(m, -1, Format(UserForm1.TextBox1, "dd-mm-yyyy

00:00:00"))

Do I need to do something else so this can be manipulated using DateAdd

method

Max



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,080
Default Using DateAdd with a text string

The Format function yields a string. Try converting it back to a date using
the DateValue function.

--

Vasant

"Max" wrote in message
...
I have a textbox that I am entering a date and want to do some date

calculations on it.

I have the following but my suspician is this is returning a string

Startdate = Format(UserForm1.TextBox1, "dd-mm-yyyy 00:00:00")

I tried the following but it there is a Type Mismatch

Startdate = DateAdd(m, -1, Format(UserForm1.TextBox1, "dd-mm-yyyy

00:00:00"))

Do I need to do something else so this can be manipulated using DateAdd

method

Max



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
Change 3 letter text string to a number string Pete Excel Discussion (Misc queries) 3 December 31st 07 07:47 PM
Dateadd function Dr. Maunuk Excel Discussion (Misc queries) 2 September 28th 07 07:32 AM
dateadd The BriGuy[_2_] Excel Discussion (Misc queries) 1 March 29th 07 06:51 PM
Using DateAdd Function with cell values loren.pottinger Excel Discussion (Misc queries) 3 August 30th 06 01:10 AM
DateAdd function Bill[_19_] Excel Programming 2 November 12th 03 07:07 PM


All times are GMT +1. The time now is 04:39 AM.

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"