Macro to combine date and time column

tsherv

New Member
Joined
Dec 14, 2011
Messages
20
Hi,

I have a spreadsheet that is generated from my ERP that has a date in column F and a time in column G. I need to create a macro that would combine both columns into one column (to the bottom of the range) and then delete one of the columns so there is only 1 date / time column.

Any ideas how to do this?

Thanks.
 

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
Try using Power Query. It used to be a free Excel Add In in the older versions but changes are you can already find it under the name "Get & Transform" from the Data tab of your current Excel.

YouTube is filled with all kinds of Power Query tutorials. You might want to spend a few minutes watching those to get you started but the main trick you're going to have to do is first to make sure your columns are datatypes date (date column) and time (time column). Once you've done that select both columns and use the Combine Date and Time found under the Date button on the Transform tab. Make sure to convert the combined column as Date / Time datatype before loading your query to your new table (I'm guessing that's what you want to do).
 
Upvote 0
Is there any other way to combine date and time fields where it could be accomplished through a macro?
 
Upvote 0

Forum statistics

Threads
1,214,924
Messages
6,122,293
Members
449,077
Latest member
Rkmenon

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