I want to concatenate one cell with a date with one cell with a time and assign the value to a third cell.

ScottInTexas

Board Regular
Joined
Oct 28, 2003
Messages
178
I just want to concatenate 7:05 (Range("a21") to 6/3/2020 Range("a22") and stuff it in Range("J1"). I guess I forgot how because I keep getting "6/3/2020 0.329861111111111" in Range("j1"). I tired formatting with
VBA Code:
Range("Completed").value = Format(Range("a21").value & " " & Range("a22").value, "MM/dd/yyyy HH:mm")
doesn't work. Setting the cells value type, i.e. to Time, doesn't work either. Just concatenating the two and putting it into a Date cell doesn't work.

Thanks for the help.
 

Excel Facts

Add Bullets to Range
Select range. Press Ctrl+1. On Number tab, choose Custom. Type Alt+7 then space then @ sign (using 7 on numeric keypad)
How about
VBA Code:
Range("Completed").value =Range("a21").value + Range("a22").value
 
Upvote 0
That's exactly what did not work, as I said in my OP. I don't want them added. I want them concatenated. in other words it should end up 6/08/2020 7:50 AM.
 
Upvote 0
Do you want the result as text or as an actual date/time value? Fluff's code should give you the latter, so you just need to format the cell to display the way you want.
 
Upvote 0
OK. I tried Fluff's answer again. This time I got a value of four thousand something. I could not get it to format as a date and time . So I closed the workbook. I came back to it a moment ago and ran the same code and it showed up correctly. Don't ask me why.
 
Upvote 0
Glad it's working & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,214,788
Messages
6,121,577
Members
449,039
Latest member
Arbind kumar

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