Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default 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

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 31
Default 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!



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default 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!



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Filling an array with integer variable Erche DP Excel Programming 1 May 13th 04 04:14 PM
Join string with variable name to get variable value Dianne Excel Programming 6 February 12th 04 04:24 AM
Is variable an integer? Otto Moehrbach[_6_] Excel Programming 7 February 6th 04 04:31 PM
OutlineLevel and Integer Variable issue jurgenC![_2_] Excel Programming 2 January 30th 04 10:32 PM
VBA - Convert my variable range array to single cell string Kevin G[_2_] Excel Programming 6 January 28th 04 07:20 AM


All times are GMT +1. The time now is 02:59 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"