macro - change format in other sheet

en_passant

New Member
Joined
Feb 10, 2016
Messages
13
Hi guys,



I'm trying to change the format of cells and move them to another excel sheet.


The format is this: 19/07/2016 03:22:49 - which is - yy(end of 2019)/mm/yy(beginning of 2019)dd, so yy/mm/yydd.


I'm changing it so it shows as dd/mm/yy and when I run this code - the format changes as I want it to (with the sheet already open):


' Workbooks.Open Filename:="C:\Users\epass\Desktop\800xxx.csv"
Windows("800xxx.csv").Activate
Range("B2:B10").Select
Selection.NumberFormat = "yy/mm/dd hh:mm:ss"


This macro is saved in another sheet. When I then close the sheet and run this:


Workbooks.Open Filename:="C:\Users\epass\Desktop\800xxx.csv"
Windows("800xxx.csv").Activate
Range("B2:B10").Select
Selection.NumberFormat = "yy/mm/dd hh:mm:ss"


It does not change the format. It remains as it is above. The format shows as having been changed but the text in the cell hasn't changed and whatever I do with the format options it won't allow it to change after that code has run.

Regards,
*e_p
 

Excel Facts

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.

Forum statistics

Threads
1,214,583
Messages
6,120,377
Members
448,955
Latest member
BatCoder

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top