Concating Numbers and Dates Columns

Julmust Jaeger

New Member
Joined
Jul 20, 2022
Messages
20
Office Version
  1. 2016
Platform
  1. Windows
Hello,

I am trying to make a pretty simple CONCAT macro to combine cells from each row (A & B) into a new column (D). A is composed of numbers and B is composed of dates (dd/mm/yy).

I have ended up with the following code which works very well posted in an earlier thread.

I am looking to make too small changes, though, I would like to not have the column have to be filled for it to run (I think this is the IF({1}," portion) and I would like the column B to remain in Date format.
VBA Code:
Sub mayoung()
   With Range("D2", Range("D" & Rows.Count).End(xlUp))
      .Value = Evaluate("If({1}," & .Offset(, -3).Address & "&""_""&" & .Offset(, -2).Address & ")")
   End With
End Sub

Other VBA solutions/approaches are also obviously welcome!

TYA!
 

Excel Facts

Save Often
If you start asking yourself if now is a good time to save your Excel workbook, the answer is Yes
How about
VBA Code:
Sub Julmust()
   With Range("D2:D" & Range("A" & Rows.Count).End(xlUp).Row)
      .Value = Evaluate("If({1}," & .Offset(, -3).Address & "&""_""&text(" & .Offset(, -2).Address & ",""dd/mm/yy""))")
   End With
End Sub
 
Upvote 0
Solution
Amazing, thanks!

Super awesome that you were the one to answer my question too since you answered the OP!
 
Upvote 0

Forum statistics

Threads
1,214,979
Messages
6,122,561
Members
449,089
Latest member
Motoracer88

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