ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How do I convert an integer variable to a string variable? (https://www.excelbanter.com/excel-programming/299099-how-do-i-convert-integer-variable-string-variable.html)

Dumbass

How do I convert an integer variable to a string variable?
 
Hi

I am trying to build a formula in string format for pasting, but want to add a number to it. But when you try to append an integer variable to the string it comes up with a type mismatch error. How can I convert the integer variable to a string? The value function from Excel does not seem to work

Thanks


Township of East Hanover

How do I convert an integer variable to a string variable?
 
The Str function converts a number to a string. For instance:

Str(123)

This is if you are writing a macro with vba. If you are writing a formula in
a cell then I can't help you.

Rui

"dumbass" wrote in message
...
Hi-

I am trying to build a formula in string format for pasting, but want to

add a number to it. But when you try to append an integer variable to the
string it comes up with a type mismatch error. How can I convert the integer
variable to a string? The value function from Excel does not seem to work.

Thanks!




Bob Phillips[_6_]

How do I convert an integer variable to a string variable?
 
This should work

myVal = 123
myString = "abc" & myVal

or to be sure

myString = "abc" & CStr(myVal)
--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"dumbass" wrote in message
...
Hi-

I am trying to build a formula in string format for pasting, but want to

add a number to it. But when you try to append an integer variable to the
string it comes up with a type mismatch error. How can I convert the integer
variable to a string? The value function from Excel does not seem to work.

Thanks!





All times are GMT +1. The time now is 01:46 AM.

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