ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   VBA to concatenate Text and/or Numbers and/or dates etc (https://www.excelbanter.com/excel-discussion-misc-queries/101069-vba-concatenate-text-numbers-dates-etc.html)

[email protected]

VBA to concatenate Text and/or Numbers and/or dates etc
 
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

Therefo
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

Dave Peterson

VBA to concatenate Text and/or Numbers and/or dates etc
 
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

wrote:

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

Therefo
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


--

Dave Peterson

[email protected]

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

Dave Peterson wrote:

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

wrote:

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

Therefo
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



All times are GMT +1. The time now is 07:31 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com