Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 19
Default # added to number in function procedure

Hi All,

Does anyone know why VBA would add a # after a number.

I type in:

anNewIP = anNewIP + 2147483648

And when I move to the next line the code changes to:

anNewIP = anNewIP + 2147483648#

I've never seen this before.

Thanks.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 860
Default # added to number in function procedure

Hi Erin,

I can tell you what's happening, but not why. Maybe someone else can fill
in the gaps. A Long Integer only goes to 2,147,483,647. When you type the
next number up, VBA adds a # to the end, which is the type-declaration
character for a Double. Maybe since you typed what looks like an integer,
VBA adds the # to let you/itself know that the value must be represented as
a floating point value instead. FWIW, if you add a decimal fraction to the
number, VBA does not add the #.

--
Regards,

Jake Marx
MS MVP - Excel
www.longhead.com

[please keep replies in the newsgroup - email address unmonitored]


Erin wrote:
Hi All,

Does anyone know why VBA would add a # after a number.

I type in:

anNewIP = anNewIP + 2147483648

And when I move to the next line the code changes to:

anNewIP = anNewIP + 2147483648#

I've never seen this before.

Thanks.


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 19
Default # added to number in function procedure

Thanks, Jake. That explains it. Sure enough it doesn't
happen with 2147483647. Interesting.

-----Original Message-----
Hi Erin,

I can tell you what's happening, but not why. Maybe

someone else can fill
in the gaps. A Long Integer only goes to 2,147,483,647.

When you type the
next number up, VBA adds a # to the end, which is the

type-declaration
character for a Double. Maybe since you typed what looks

like an integer,
VBA adds the # to let you/itself know that the value must

be represented as
a floating point value instead. FWIW, if you add a

decimal fraction to the
number, VBA does not add the #.

--
Regards,

Jake Marx
MS MVP - Excel
www.longhead.com

[please keep replies in the newsgroup - email address

unmonitored]


Erin wrote:
Hi All,

Does anyone know why VBA would add a # after a number.

I type in:

anNewIP = anNewIP + 2147483648

And when I move to the next line the code changes to:

anNewIP = anNewIP + 2147483648#

I've never seen this before.

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
How to run external workbook function/procedure? Vinod Excel Discussion (Misc queries) 3 August 10th 09 02:03 PM
Create a procedure or function Alexandra Lopes Excel Worksheet Functions 0 November 19th 08 10:00 AM
Error: The procedure number is out of range Van S. Mabrito Excel Programming 1 February 19th 04 11:33 AM
Calling a Custom Function within a Procedure [email protected] Excel Programming 1 November 16th 03 03:51 AM


All times are GMT +1. The time now is 07:54 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"