Excel Macro Help
Discussion
Can anyone please?
I need to reformat cells from 2023/11/01T08:00 to 2023-11-01T08:00.
Format Painter doesn't seem to work, nor does Custom Format Cell, I suspect it's the letter T in the middle of the date and time format that stops it from happening.
I create a simply Macro by just going into the cell and deleting the the forward slash and put in the dash. The problems I encounter is (1) After doing the Macro it stay in the same cell/go back to the first cell I altered. (2) I try to add some additional instructions (one click job) for the macro to be copied to a range of cells, but it just copies the first cells data and not the format.
I need help either with changing the whole range of cells or making the Macro go to the next cell down, there should be a simple answer but I can't find it.
Thanks
I need to reformat cells from 2023/11/01T08:00 to 2023-11-01T08:00.
Format Painter doesn't seem to work, nor does Custom Format Cell, I suspect it's the letter T in the middle of the date and time format that stops it from happening.
I create a simply Macro by just going into the cell and deleting the the forward slash and put in the dash. The problems I encounter is (1) After doing the Macro it stay in the same cell/go back to the first cell I altered. (2) I try to add some additional instructions (one click job) for the macro to be copied to a range of cells, but it just copies the first cells data and not the format.
I need help either with changing the whole range of cells or making the Macro go to the next cell down, there should be a simple answer but I can't find it.
Thanks
simon_harris said:
it might be easier to use power query for what you are trying to do, I find it far more useful when doing conversions than macros or formulae.
Sorry I never used Power Query before, I had a look at some examples of what it can do, but doesn't mentioned my problem. Edited by Ridealong on Monday 4th December 11:50
Fore Left said:
Mr Pointy said:
That only works if you input the date/time in the normal format i.e. dd/mm/yyyy hh:mm. It doesn't work if you change the format of cells that already have data in them in the format yyyy-mm-ddThh:mm.bigandclever said:
Mr Pointy said:
Of course if cells already have data it doesn't change.
Isn't that the OP's problem? He already has data that isn't in the right format (nor in a date format).Ridealong said:
Sorry I never used Power Query before, I had a look at some examples of what it can do, but doesn't mentioned my problem.
It can do pretty much anything and it's pretty easy to pick up and just use the GUI to find an answer to your issue. It is macros on steroids for organised data.Edited by Ridealong on Monday 4th December 11:50
Your issue you simply select the column that's wrong, replace the T with a colon, then format the column as DateTime or Date, whatever you need. Then any new data will get the same transformations applied to it.
What you lose is the immediacy and instant calculation that happens in an Excel Workbook; the result from Power Query you load into a Pivot Table or Chart and when you add new data you need to Refresh those to pull the new, transformed, data through.
Unless you're modelling something across cells and formulas, Power Query is where I would always start. It means you can separate the data collection thing from the data presentation thing with what is essentially a powerful and easy to use enterprise-grade ETL process in the middle. When you put the results into Power Pivot and create relationships between tables, you have a very powerful database inside Excel.
Gassing Station | Computers, Gadgets & Stuff | Top of Page | What's New | My Stuff