LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 586
Default Textboxes Not Calculating Properly

I have 4 Textboxes that I use to calculate a length of an outdoor sign.
Height in Feet, Height in Inches, Width in Feet, and Width in Inches. I want
to click a command button and the code will automatically round the height
and width to the nearest 1/16th of an inch. But for some reason when I enter
0.125 or 0.0625 in both of the inch textboxes the numbers returned are not
equal, why?

Private Sub cmbEstimate_Click()

Dim Lheight As Double
Dim Lwidth As Double
Dim Hft As Double
Dim Hins As Double
Dim Wft As Double
Dim Wins As Double

Lheight = Val(tbxHeightFt) + Val(tbxHeightIns) / 12 'face height in ft
MsgBox Lheight
Lwidth = Val(tbxWidthFt) + Val(tbxWidthIns) / 12 'face width in ft
MsgBox Lwidth

'dimensions of cabinet in feet & inches
Hft = Int(Lheight)
MsgBox Hft
Hins = WorksheetFunction.Ceiling((Lheight - Hft) * 12, 0.0625)
MsgBox Hins
Wft = Int(Lwidth)
MsgBox Wft
Wins = WorksheetFunction.Ceiling((Lwidth - Wft) * 12, 0.0625)
MsgBox (Wins)

End Sub

Thanks in Advance,
Ryan
 
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
Textboxes not Calculating properly RyanH Excel Programming 6 December 13th 07 01:42 PM
Show Results in TextBoxes, ONLY if All TextBoxes have Data in them RyanH Excel Programming 3 November 19th 07 03:30 PM
calculating textboxes enyaw Excel Programming 1 July 13th 06 03:03 PM
Formulas not calculating properly SueK Excel Discussion (Misc queries) 2 May 10th 05 08:02 PM
Calculating with textboxes.... Mark Rosenkrantz Excel Programming 4 November 23rd 03 12:42 PM


All times are GMT +1. The time now is 11:04 PM.

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"