Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

convert to date 1

Status
Not open for further replies.

jluft

Technical User
May 4, 2004
74
US

i have the following code which grabs number from a text string, and converts them to the typical excel date format

PrimaryGraphArray(UserGraphLoop, 10) = Application.WorksheetFunction.Text(Month(Left(PrimaryGraphArray(UserGraphLoop, 10), 8)) & "-" & _
Day(Left(PrimaryGraphArray(UserGraphLoop, 10), 8)) & "-" & _
Year(Left(PrimaryGraphArray(UserGraphLoop, 10), 8)), "MM/DD/YYYY")

i am then trying to subtract a different value that excel has already recognized properly as a date

when i do this, the above code still generates the first date as text, and therefore cannot subtract a different date from it.

how can i get this to be recognized properly as a date? thanks
 

date_from_array=Application.WorksheetFunction.datevalue(PrimaryGraphArray(n))
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top