LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 703
Default a string to an integer

Type mismatch probably comes from the fact you are using "int"

int = CInt()

Int is an intrinsic function in VB. You shouldn't name a variable "int"

As for the other problem use Mid not Right to get the remaining portion of
the string

if left(a,1)="-" then a=mid(a,2)

"Philosophaie" wrote:

I have a string:

string(3) = "543"

I try to change it to an integer:

int = cint(string(3))

It gives me a 'Type Mismatch' Error.

Maybe there may be spaces before of after the numbers but does that matter?

How do I change from a string to an integer?

 
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
String to Rounded Integer StumpedAgain Excel Programming 3 June 11th 08 08:08 PM
convert string to integer eugene Excel Programming 7 February 20th 07 07:00 PM
Varaibles as both integer and String RominallL Excel Programming 5 January 31st 07 06:33 PM
String or integer? JustinP Excel Programming 2 September 5th 06 06:56 AM
Compare string with integer hurriance[_8_] Excel Programming 2 June 26th 06 09:14 AM


All times are GMT +1. The time now is 06:27 AM.

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"