VBA to concatenate Text and/or Numbers and/or dates etc

  • Thread starter donoteventry;removes;pam
  • Start date
D

donoteventry;removes;pam

2003

What function(s) in VBA could I use to treat the contents of any cell as text, so that, I could
concatenate all of the information.

C1 = Chicago
D1 = is
E1 = 252
F1 = miles
G1 = 7/24/2006

Therefore:
A1 = C1&D1&E1&F1&G1 (Of course this formula does not work because the data is inconsistent)

Complicating matters is that columns C thru G can have any type of data.

Is this a hopless case?

Thanks EagleOne
 
D

Dave Peterson

In excel, you could use a formula like:
=c1 & " " & d1 & " " & e1 & " " & f1 & " " & text(g1,"mm/dd/yyyy")

If you wanted VBA, you could use J.E. McGimpsey's multicat user defined
function:
http://mcgimpsey.com/excel/udfs/multicat.html

You'll see that J.E. relies on the .Text property (not .Value).

and you'd use:
=multicat(c1:G1)

in your cell
 
D

donoteventry;removes;pam

Thanks David

Dave Peterson said:
In excel, you could use a formula like:
=c1 & " " & d1 & " " & e1 & " " & f1 & " " & text(g1,"mm/dd/yyyy")

If you wanted VBA, you could use J.E. McGimpsey's multicat user defined
function:
http://mcgimpsey.com/excel/udfs/multicat.html

You'll see that J.E. relies on the .Text property (not .Value).

and you'd use:
=multicat(c1:G1)

in your cell
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top