LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Excel VBA - Data Type Conversion problem

All I want to do is display today's date in 3 separate boxes for Day
Month and Year.

I have tried the following code to split the date into 3 strings:

Dim TodaysDate As Date
Dim strDate As String
Dim myDay As String
Dim myMonth As String
Dim myYear As String

TodaysDate = Format(Date, "dd/mm/yy")
strDate = CStr(TodaysDate)
myDay = Left(Cells(strDate, 1), 2)
myMonth = Mid(Cells(srtDate, 1), 4, 2)
myYear = Mid(Cells(srtDate, 1), 7, 2)


However, it says there is a type mismatch on the line:
myDay = Left(Cells(strDate, 1), 2).

There must be a simple solution but I can't find it.

Pau

--
Message posted from http://www.ExcelForum.com

 
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
data conversion problem cinnie Excel Discussion (Misc queries) 3 February 23rd 08 10:54 PM
File Type Conversion Steve Excel Discussion (Misc queries) 0 February 8th 08 02:04 PM
Data Type Problem? bailey Excel Discussion (Misc queries) 8 December 6th 05 03:51 AM
COUNTIF and automatic type conversion problem joes Excel Discussion (Misc queries) 2 July 25th 05 03:26 PM
COUNTIF and automatic type conversion problem joes Excel Worksheet Functions 2 July 25th 05 03:26 PM


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