Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 21
Default Simple addition problem

Hello, I've got this line of code:

iVarOutRight(iNumVar) = iVarOutCol(iNumVar) + iVarOutWidth(iNumVar)

Simple enough you'd have thought, but it's assuming the values are
strings when they are integers as it is concatenating them, for
example:

5 + 60 = 560

How do I get it to just add them up to give 65 as the result (for
example)?

Thanks!

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 21
Default Simple addition problem

Sorry, I worked it out, using:

iVarOutWidth(iNumVar) = CInt(iVarOutWidth(iNumVar))
iVarOutCol(iNumVar) = CInt(iVarOutCol(iNumVar))

If there's a better way let me know, thanks.


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,624
Default Simple addition problem

How are iVarOutCol() and iVaroutWidth() declared/assigned?

If they're both declared/assigned as String, you'll get the
concatenation.



In article .com,
" wrote:

Hello, I've got this line of code:

iVarOutRight(iNumVar) = iVarOutCol(iNumVar) + iVarOutWidth(iNumVar)

Simple enough you'd have thought, but it's assuming the values are
strings when they are integers as it is concatenating them, for
example:

5 + 60 = 560

How do I get it to just add them up to give 65 as the result (for
example)?

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
simple addition pitydafool Excel Discussion (Misc queries) 4 January 30th 09 10:44 PM
Simple Addition Function sneal Excel Worksheet Functions 3 September 11th 08 07:36 PM
simple addition Don Guillett Excel Programming 0 January 10th 07 06:09 PM
Simple Math Addition ssjody[_4_] Excel Programming 2 July 21st 06 09:51 AM
My problems with simple addition ... Larry Levinson Excel Programming 4 April 23rd 04 05:20 PM


All times are GMT +1. The time now is 11:28 AM.

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

About Us

"It's about Microsoft Excel"