LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,565
Default Dividing variables

If you are dimesioning you variable intPct as an integer, you will get a 0
value. The intPct should be dimensioned as a double to get the decimal
value of a percent.

Dim intPct As Double


"Merlynsdad" wrote in message
...
I need to divide two variables by each other to get a percentage.

intRows represents the total rows in the spreadsheet.
intPerf represents the rows left after I remove some rows with code.
intPct = intPerf/intRows.

All are dimensioned as integers.

When I do the calculation the value in the Watch List of intRows is 88,
intPerf is 34. intPct should then be 38.63% but is showing zero. The code
for
the division is

intPct=intPerf/intRows

What am I doing wrong?



 
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
Dividing by zero jvega Excel Worksheet Functions 13 June 9th 08 10:49 PM
Storing variables in a macro and using those variables to performcalculations. [email protected] Excel Programming 3 December 10th 07 04:13 PM
Dividing name kd Excel Worksheet Functions 1 April 19th 07 04:48 AM
Dividing by zero careyc Excel Discussion (Misc queries) 5 March 17th 06 11:03 PM
dividing a row LostNFound Excel Worksheet Functions 2 March 7th 05 05:49 PM


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