ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   date format problem using Macro (https://www.excelbanter.com/excel-discussion-misc-queries/206311-date-format-problem-using-macro.html)

mohavv

date format problem using Macro
 
Hi,

I import files with dates like this: 12.02.2007 (dd.mm.yyyy)

When I run a find and replace it changes to 12/02/2007. This is ok.

BUT when I record this exact find and replace in a Macro then suddenly
it changes it to: 02/12/2007 but still as dd/mm/yyyy

How is this possible, and how to solve this.

Cheers,

Harold

Sheeloo[_3_]

date format problem using Macro
 
My default date format is mm/dd/yyyy so when I pasted 12.02.2007 in a cell
and replaced . with / I got
12/02/2007 which is 2-Dec-2007...

What do you mean when you say you get 12/02/2007 through a macro? If you
pass it as an string to the macro you will get it back as a string... when
you paste the string in a cell with date format Excel will interpret it and
show it accordingly (which should be same as manual search and replace)...

If this does not solve your problem then pl. paste the macro and paste the
date after formatting it as "mmm-dd-yyyy"
--
If you find this post helpful pl. choose "Yes"...


"mohavv" wrote:

Hi,

I import files with dates like this: 12.02.2007 (dd.mm.yyyy)

When I run a find and replace it changes to 12/02/2007. This is ok.

BUT when I record this exact find and replace in a Macro then suddenly
it changes it to: 02/12/2007 but still as dd/mm/yyyy

How is this possible, and how to solve this.

Cheers,

Harold



All times are GMT +1. The time now is 12:08 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com