View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Ed Ed is offline
external usenet poster
 
Posts: 399
Default Change date format in string?

No, Bob, it doesn't work. Not only that, but I've been trying desperately
to do everything I can to make it work. I made a copy of the spreadsheet
and changed the format of all these cells to DATE as yyyymmdd. That gave
them the correct look, but they wouldn't filter with "greater than or equal
to" - but they WILL filter on "equal to".

So I copied the entire column into Word as a single-column table, the
repasted back into Excel, just to have everything as pure text. Then I
formatted the cells as NUMBER with no decimals. Same thing: filters on
"equals" but not "greater than".

The only thing I can think of is that I have changed the way I create this
spreadsheet. The previous versions (in which the filter worked fine) were
built from a database query table opened in Excel. The same column there is
also formatted NUMBER, no decimals. But the numbers came out of the
database as "20030202". This sheet, though, is built by searching a text
doc for strings and inserting them into the cell as
"Cell(r,c).Value="string". Doing this, the search finds the date field "02
Feb 2002" and writes it into the cell, where Excel automatically formats it
as a DATE, showing "02-Feb-02", but yielding the date value in the formula
bar.

Can you give me any hints?

Ed
"Bob Phillips" wrote in message
...
Does it not work then. I ask because if the dates are just formatted
differently, the underlying date values are the same.

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Ed" wrote in message
...
I have a macro which AutoFilters a date column. The spreadsheet is now
being created differently, and the dates are coming up in a different
format. Currently, I have
If MyTarget = "d" Then
Selection.AutoFilter Field:=5, Criteria1:="=20020703", _
Operator:=xlAnd, Criteria2:="<=20030616"
End If

Is there any way to change these dates to "03-Jul-02" on the fly? Or do

I
need to go into the macro and redo the date for every If?

Ed