Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Value compare problem, As Single variables Feb09
The If statement code snippet below is failing, the else
branch is taken for two seemingly = values. All values are dim'd As Single uEPPAy is an array of user type records. Prior to this: Weeks 1 and 2 hours are split in the worksheet by formula into regular and Overtime OTi hours. Cells are number format with 2 decimals, (via time clock hundreths of an hour). 'Check total, control all hours, sum Wk 1,2, sum Reg+OT, must be = . uEPPAy(Ix).nPPTotHrs = uEPPAy(Ix).nWk1TotHrs + uEPPAy(Ix).nWk2TotHrs nPPchkTotHrs = uEPPAy(Ix).nPPRegHrs + uEPPAy(Ix).nPPOTiHrs uEPPAy(Ix).nPPTotHrs, dim'd single nPPchkTotHrs, in the macro's vba. debug.Print format(uEPPAy(Ix).nPPTotHrs,"0.000000000") 56.480000000 debug.Print format(nPPchkTotHrs,"0.000000000") 56.480000000 If uEPPAy(Ix).nPPTotHrs = nPPchkTotHrs Then 'code for controls are = else 'this code is executing on above values ???? end if Why is this happening ? Is a Single value in a record 'different' from a VBA variable? Do I have to "fool around" with Single type values when comparing them? Something like: if abs(value - value) < 0.001 then else end if Thanks, Neal Z. -- Neal Z |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Compare variables in two excel workbooks | Excel Programming | |||
How to store variables of a single cell in a column? | Excel Programming | |||
From single cell variables to a single column serie | New Users to Excel | |||
Compare two variables across two worksheets | Excel Worksheet Functions | |||
Compare two lists with two variables | Excel Worksheet Functions |