Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Could someone please help me with a silly little problem that is really
bugging me. I have just started learning Visual Basic and am having difficulty with the MOD operator. If I set up a formula using the MOD function in an Excel workbook: =MOD(2.08, 1) * 100 I get the expected result 8 in the cell. If I then try to use the MOD operator to get the same result in a VBA procedu Var1 = 2.08 Var2 = (Var1 Mod 1) * 100 MsgBox Var2 I get the result of 0 in Msgbox instead of the expected 8. I have just done some more searching and found a reply to a recent post on this newsgroup which mentioned briefly that floating point numbers are rounded to integers and this causes mod 1 to return 0. Is there any way of using the Mod operator to get the result I am after or is it a lost cause? Terry Holmes PS. A second question €“ is it possible to change the names of modules in the Project Explorer? (I find that lists of names like module 1, module 2, module 3 etc. in the tree under each workbook are not very informative to help you remember where you wrote a piece of code and would like to change them to something more meaningful. What looks like the obvious solution - right-clicking on the module name in the tree - takes you to a dialogue box that only lets you change the project name). -- Terry Holmes |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Difficulty with Sum+IF Function | Excel Worksheet Functions | |||
Function Difficulty | Excel Discussion (Misc queries) | |||
Difficulty in transposing | New Users to Excel | |||
VLOOKUP Difficulty | Excel Discussion (Misc queries) | |||
AutoFill difficulty | Excel Programming |