# 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. |
# 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. |
# 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. . |
All times are GMT +1. The time now is 11:27 PM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com