應是浮點數問題,可設msgbox c-d
" target="_blank" rel="nofollow">如取整數,可將變數c宣告為integer或long或以int(取整數)、round(四捨六入)、worksheetfunction.round(四捨五入)宣告為integer或long如遇小數位,進位方式同上述rounddouble類型的資料不一定都會有小數位的出現例如宣告變數c為double,指定為值1000時,就無小數位
" target="_blank" rel="nofollow">無宣告時,如有小數位時vba則會判斷為double測試上可加上msgbox ab=2.4,會看到這裡已產生浮點數錯誤
" target="_blank" rel="nofollow">不正確的結果,就從此處產生