ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Date fields (https://www.excelbanter.com/excel-discussion-misc-queries/82351-date-fields.html)

ir26121973

Date fields
 
Hi,

Wonder if someone can help please.

I am currently using a macro that takes many hundred .csv files that are
email attachments and copies them into one master spreadsheet. Within this
spreadsheet that are text, numeric and date fields.

When I copy the information into the master spreadsheet the date fields
change from dd/mm/yyyy hh:mm to mm/dd/yyyy hh:mm.

Has anyone an idea how I can stop this happening please? I've tried
allsorts. I know I can change the format for the fields within the excel, but
I'm wanting if possible to put this in the coding because there is an awful
lot of data to sort through.

Thanks and regards

Chris

Toppers

Date fields
 
Chris,
Try adding this to your code - amend column as needed:

Range("A:A").NumberFormat = "dd/mm/yyyy hh:mm"

HTH

"ir26121973" wrote:

Hi,

Wonder if someone can help please.

I am currently using a macro that takes many hundred .csv files that are
email attachments and copies them into one master spreadsheet. Within this
spreadsheet that are text, numeric and date fields.

When I copy the information into the master spreadsheet the date fields
change from dd/mm/yyyy hh:mm to mm/dd/yyyy hh:mm.

Has anyone an idea how I can stop this happening please? I've tried
allsorts. I know I can change the format for the fields within the excel, but
I'm wanting if possible to put this in the coding because there is an awful
lot of data to sort through.

Thanks and regards

Chris


ir26121973

Date fields
 
Hi,

Thanks for getting back to me. I'll give it a try.

Regards

Chris

"Toppers" wrote:

Chris,
Try adding this to your code - amend column as needed:

Range("A:A").NumberFormat = "dd/mm/yyyy hh:mm"

HTH

"ir26121973" wrote:

Hi,

Wonder if someone can help please.

I am currently using a macro that takes many hundred .csv files that are
email attachments and copies them into one master spreadsheet. Within this
spreadsheet that are text, numeric and date fields.

When I copy the information into the master spreadsheet the date fields
change from dd/mm/yyyy hh:mm to mm/dd/yyyy hh:mm.

Has anyone an idea how I can stop this happening please? I've tried
allsorts. I know I can change the format for the fields within the excel, but
I'm wanting if possible to put this in the coding because there is an awful
lot of data to sort through.

Thanks and regards

Chris



All times are GMT +1. The time now is 11:18 PM.

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