LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default How can I convert Text into Date? (See inside)

Jake, I used your VB code below, just what I need, but when I run it on some
sheets I get a

Run-time error 1004:
Application-defined or object-defined error

When you press debug, it highlights in yellow c.Value = CDate(c.Value)

You will probally guess I'm now VB code expert!

Any idea why it would only do this in some sheets?

"Jake Marx" wrote:

Hi Yoni,

Something like this may work for you:

Public Sub ConvertDatesInActiveSheet()
Dim c As Range

For Each c In ActiveSheet.UsedRange
If IsDate(c.Value) And Not IsNumeric(c.Value) Then
'/ convert it
c.Value = CDate(c.Value)
End If
Next c
End Sub

--
Regards,

Jake Marx
MS MVP - Excel
www.longhead.com

[please keep replies in the newsgroup - email address unmonitored]


Yonah Sudwerts wrote:
I have cells that contain Dates such as "Aug 23 2009" but, they were
copy pasted in, and Excell does not see them as dates, is there
anything I can run that can convert them?

I want to be able in the end, that when I open Excell, it can jump to
Today;s date. And alternatively, to have some kind of search option,
that will lead me to any date I want.

But that is part 2, just looking to get the text recognized as Dates
to start.

Thanks in Advance,
Yoni




 
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
Convert text date to mmddyyy date wx4usa Excel Discussion (Misc queries) 2 January 7th 10 03:27 AM
convert a text date to a true date JR Hester Excel Discussion (Misc queries) 20 November 15th 07 07:15 PM
how do i convert text to date (mm/yy text to mm/dd/yyyy date)? lindsey Excel Discussion (Misc queries) 1 July 27th 07 10:05 PM
Help: How do I convert a text date into a real date format japorms Excel Worksheet Functions 4 August 2nd 06 06:36 PM
How to convert date to text galsaba Excel Discussion (Misc queries) 2 May 22nd 05 08:31 PM


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