Add text strings together as value

User avatar
VegasNath
5StarLounger
Posts: 1185
Joined: 24 Jan 2010, 12:02
Location: Wales, UK.

Add text strings together as value

Post by VegasNath »

How can I convert text numbers into a cell as a value?

=VALUE(A61)&VALUE(B61)

Example:

A61 = 348286
B61 = 5

vba formula in A62 something like "=VALUE(A61)&VALUE(B61)" to return 3,482,865

Sorry, this seems so simple but I'm stuck in a dull moment.
:wales: Nathan :uk:
There's no place like home.....

User avatar
HansV
Administrator
Posts: 78631
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Add text strings together as value

Post by HansV »

I think you want

Range("A62").Formula = "=VALUE(A61&B61)"

(You want to concatenate first, then convert back to a number.)
Best wishes,
Hans

User avatar
VegasNath
5StarLounger
Posts: 1185
Joined: 24 Jan 2010, 12:02
Location: Wales, UK.

Re: Add text strings together as value

Post by VegasNath »

Yes, that works except it returns 3,482,865.00

How can I lose the .00
:wales: Nathan :uk:
There's no place like home.....

User avatar
HansV
Administrator
Posts: 78631
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Add text strings together as value

Post by HansV »

By setting the number format for the cell, either interactively or through code:

Range("A62").NumberFormat = "#,##0"
Best wishes,
Hans

User avatar
VegasNath
5StarLounger
Posts: 1185
Joined: 24 Jan 2010, 12:02
Location: Wales, UK.

Re: Add text strings together as value

Post by VegasNath »

:doh: Cheers Hans
:wales: Nathan :uk:
There's no place like home.....