Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 92
Default Text to Date

Hi all. Withing a sheet, there are multiple instances of a date being
formatted as text (within a cell, '10/2004). I can use the datevalue
function to convert them. But, they occur in several spots, and their
locations vary from month to month. Is there a way to scan an entire sheet,
find dates formatted as text (ie look for a "/"), and convert them to date
format so my lookup formulas work?


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,651
Default Text to Date

On Mon, 31 Oct 2005 13:53:20 -0500, "Steph" wrote:

Hi all. Withing a sheet, there are multiple instances of a date being
formatted as text (within a cell, '10/2004). I can use the datevalue
function to convert them. But, they occur in several spots, and their
locations vary from month to month. Is there a way to scan an entire sheet,
find dates formatted as text (ie look for a "/"), and convert them to date
format so my lookup formulas work?


You could try this macro:

To enter it, <alt<F11 opens the VB Editor.

Ensure your project is highlighted in the Project Explorer window, then
Insert/Module and paste the code below into the window that opens.

Change AOI to reflect the range you need to check.

<alt<F8 opens the macro dialog box. Select this macro by name, and RUN.

==================================
Option Explicit

Sub ConvDates()
Dim AOI As Range
Dim c As Range

Set AOI = [A1:Z100] 'set this to the maximum range that may include dates

For Each c In AOI
If IsDate(c.Value) Then c.Value = CDate(c.Value)
Next c
End Sub
=============================


--ron
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Text to Date

select the offending columns/locations/areas and format as date. (You don't
have to restrict selection to each individual cell, just don't select areas
that would be adversely affected by the formatting to date or the replace
command).

then do Edit=Replace
Replace What: \
Replace With: \
this should cause the date to be reevaluated and stored as a date.

--
Regards,
Tom Ogilvy

"Steph" wrote in message
...
Hi all. Withing a sheet, there are multiple instances of a date being
formatted as text (within a cell, '10/2004). I can use the datevalue
function to convert them. But, they occur in several spots, and their
locations vary from month to month. Is there a way to scan an entire

sheet,
find dates formatted as text (ie look for a "/"), and convert them to date
format so my lookup formulas work?




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
Date format to Text Date for use in Mail Merge Erinayn Excel Discussion (Misc queries) 3 April 22nd 10 06:04 AM
Excel 2007 text import as text not date dar Excel Discussion (Misc queries) 3 September 2nd 09 07:25 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
Concatenating a Text and a Date without losing orginal Date Format Hi_no_Tori Excel Discussion (Misc queries) 5 September 17th 06 06:35 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


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