Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
mj mj is offline
external usenet poster
 
Posts: 78
Default Search and Collect Date from Cell Containing a String with a Date

I have looked for this capability but haven't found exactly what I'm looking
for yet...

Within VBA on a macro I have used a "cells.replace" with great success when
locating an "old" date and replacing it with a "new" date.

strOldDate = Format(Now() - (Weekday(Now())) - 7, "mmmm d, yyyy")
strEffectiveDate = Format(Now() - Weekday(Now()), "mmmm d, yyyy")
Sheets("Executive Summary").Select
Cells.Replace What:=strOldDate, Replacement:=strEffectiveDate, _
LookAt:=xlPart, SearchOrder:=xlByRows, MatchCase:=True

Now I would like to find on the worksheet a cell with a date value in it and
collect it as the "strOldDate".
1) Is it possible to do it similar to the Cells.Replace? Or
2) If I know the exact cell I want to search (e.g.: A3)?

Thank you in advance.

--

MJ
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default Search and Collect Date from Cell Containing a String with a Date

The what and replacement string can be cell references

What:=sheets("Sheet1").Range("A1"), Replacement:=sheets("Sheet1").Range("A2")

"MJ" wrote:

I have looked for this capability but haven't found exactly what I'm looking
for yet...

Within VBA on a macro I have used a "cells.replace" with great success when
locating an "old" date and replacing it with a "new" date.

strOldDate = Format(Now() - (Weekday(Now())) - 7, "mmmm d, yyyy")
strEffectiveDate = Format(Now() - Weekday(Now()), "mmmm d, yyyy")
Sheets("Executive Summary").Select
Cells.Replace What:=strOldDate, Replacement:=strEffectiveDate, _
LookAt:=xlPart, SearchOrder:=xlByRows, MatchCase:=True

Now I would like to find on the worksheet a cell with a date value in it and
collect it as the "strOldDate".
1) Is it possible to do it similar to the Cells.Replace? Or
2) If I know the exact cell I want to search (e.g.: A3)?

Thank you in advance.

--

MJ

  #3   Report Post  
Posted to microsoft.public.excel.programming
mj mj is offline
external usenet poster
 
Posts: 78
Default Search and Collect Date from Cell Containing a String with a D

Joel, perhaps I did not make myself clear... I wish to collect a date from a
string located in a cell to use to increment the effective date.

After I increment that data, then I would use the replace code as previously
written, unless there is a better idea out there.

Thanks again
--

MJ


"Joel" wrote:

The what and replacement string can be cell references

What:=sheets("Sheet1").Range("A1"), Replacement:=sheets("Sheet1").Range("A2")

"MJ" wrote:

I have looked for this capability but haven't found exactly what I'm looking
for yet...

Within VBA on a macro I have used a "cells.replace" with great success when
locating an "old" date and replacing it with a "new" date.

strOldDate = Format(Now() - (Weekday(Now())) - 7, "mmmm d, yyyy")
strEffectiveDate = Format(Now() - Weekday(Now()), "mmmm d, yyyy")
Sheets("Executive Summary").Select
Cells.Replace What:=strOldDate, Replacement:=strEffectiveDate, _
LookAt:=xlPart, SearchOrder:=xlByRows, MatchCase:=True

Now I would like to find on the worksheet a cell with a date value in it and
collect it as the "strOldDate".
1) Is it possible to do it similar to the Cells.Replace? Or
2) If I know the exact cell I want to search (e.g.: A3)?

Thank you in advance.

--

MJ

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
This cell contains a date string rep. with only 2 digits for the y jdungan Excel Discussion (Misc queries) 5 June 5th 09 05:40 PM
Combining Date and String into 1 cell gtslabs Excel Worksheet Functions 3 October 22nd 08 07:21 AM
VBA convert day and date from text string to Excel date Max Bialystock[_2_] Excel Programming 5 May 14th 07 04:54 AM
search for date in long string of text ryan00davis Excel Discussion (Misc queries) 4 August 11th 06 07:06 PM
Search in excel by date located in a cell Btobin0 Excel Discussion (Misc queries) 6 May 27th 06 03:20 PM


All times are GMT +1. The time now is 08:15 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"