home hardware prices news articles forums photos user reviews
Go Back   Tech Support Forums - TechIMO.com > TechIMO Community > IMO Community
Ask a Tech Support Question (free)!

Excel question VB question

Reply
Get bargains at  »  Dealighted.com
 
Thread Tools Search this Thread
Currently Active Users: 1500
Discussions: 200,933, Posts: 2,379,168, Members: 246,297
Old March 8th, 2006, 03:30 PM   Digg it!   #1 (permalink)
MR Meek and Mild
 
Epidemic's Avatar
 
Join Date: Mar 2002
Location: almost Virginia
Posts: 5,115
Blog Entries: 2
Excel question VB question

Dim StrtRWf2 As Long
Dim RPCF2 as Integer

Sub Macro3()
RPCF2= 375
Cl = 89

StrtRWf2 = (CL - 1) * RPCF2 + 3 ' Start Row for F2 data

End Sub

Ok I run this macro and it gives me an overflow error. Originally I DIM'd the variable as Integer but I have exceeded the 16 bit 32,000 number.

So I tossed in a DIM as Long and that should allow for +2 billion to - 2 billion.


Any ideas why it is still overflowing.

I know I have solved this in the past but cant for the life of me remember the sollution.

Last edited by Epidemic : March 8th, 2006 at 03:33 PM.
Epidemic is offline   Reply With Quote
Old March 8th, 2006, 03:34 PM     #2 (permalink)
Member
 
Zitch's Avatar
 
Join Date: Aug 2002
Location: Lafayette, Louisiana
Posts: 167
Send a message via ICQ to Zitch Send a message via AIM to Zitch Send a message via Yahoo to Zitch
That subroutine should assign 33003 (result of the calculation) into StrtRWf2, which a long type should handle. I'm not seeing where the issue might lie (unless you have a StrtRWf2 dimmed as an integer elsewhere and it's using that for some reason...)

Hey! You added to it since then!

Try setting up RPCF2 as a long. It's possible that the system is expecting an integer output between Cl and RPCF2, and that's overflowing...
Zitch is offline   Reply With Quote
Old March 8th, 2006, 03:39 PM     #3 (permalink)
Member
 
Zitch's Avatar
 
Join Date: Aug 2002
Location: Lafayette, Louisiana
Posts: 167
Send a message via ICQ to Zitch Send a message via AIM to Zitch Send a message via Yahoo to Zitch
Just tested it myself, and yes, it's expecting an integer from (CL - 1) * RPCF2 + 3 because everything in there is an integer. If you dim RPCF2 as long, it'll work.
Zitch is offline   Reply With Quote
Old March 8th, 2006, 03:45 PM     #4 (permalink)
MR Meek and Mild
 
Epidemic's Avatar
 
Join Date: Mar 2002
Location: almost Virginia
Posts: 5,115
Blog Entries: 2
Excellent.

I just solved it myself but through a much less scientific method.

I just started Dimming all the components to long out of frustration.

I am still not quite sure why it fails though.

Scenario 1

pickle = 32,000 *10 ------------ works just fine

Dim Pickle as integer

Pickle = 32,000* 10 -------------- works fine

but

RPCF2= 375
Cl = 89

StrtRWf2 = (CL - 1) * RPCF2 + 3


Well I guess I am just a butcher when I program.
Epidemic is offline   Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search

Similar Threads
Thread Thread Starter Forum Replies Last Post
Excel question... FalcomPSX Applications and Operating Systems 4 September 29th, 2005 08:11 PM
Excel Question ClubMed Applications and Operating Systems 1 July 18th, 2005 08:13 AM
One question in MS-Excel ? Indian Applications and Operating Systems 2 November 11th, 2004 07:36 AM
Question About MS Excel PeterGriffin Applications and Operating Systems 3 March 5th, 2003 06:24 PM
Excel question jezzebelld Applications and Operating Systems 14 October 21st, 2002 12:41 PM


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Most Active Discussions
Is It Just Me? (2875)
Obama the Muslim (14)
California Passes Anti-Flat-HDTV Le.. (39)
Is the PSU I received dead? (10)
windows vista security holes (9)
Install XP pro and a Vista laptop ?.. (11)
HIS HD5770 graphic card question (15)
Print spooler problem (13)
Foreign voltage (10)
Dept. of HS: NSA 'Helped' Develop V.. (15)
A good PSU? (10)
Ideal cheap graph card for PC-Gamin.. (17)
EVGA 9800 gtx help with finding a g.. (8)
New Computer wont recognize XP disc (7)
Recent Discussions
Ideal cheap graph card for PC-Gaming? (17)
CPU fan stops spinning randomly (0)
BIOS won't read disk when I try to fl.. (0)
Wireless Televisions. (0)
Install XP pro and a Vista laptop ?? (11)
Partition Magic caused HDD problem (2)
Graphics Card Upgrade Question (1)
favorit (1)
solutions for virtical white lines on.. (1)
Regular Build (3)
Fire in DVD (2)
Modern Warfare For the PC (33)
radeon x850xt platinum & shader 3 (3)
Have you switched yet? (84)
Wireless Router+Cable Modems and Much.. (0)
Optical Audio A-B Switch (1)
windows vista security holes (9)
The NTDVM CPU has encountered an ille.. (24)
[F@H SPAM 11/16/09] ! 1/2 months to r.. (34)
Wireless speakers for PC? (11)
Print spooler problem (13)
Help getting around port 80 for camer.. (2)
Display shows 3x5 inch in middle of s.. (3)
monitor will not turn on at all, (1)
World's largest Monopoly Game using G.. (331)


All times are GMT -4. The time now is 08:45 AM.
TechIMO Copyright 2009 All Enthusiast, Inc.



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28