R
RyanH
I have a Userform with 4 Textboxes labeled Height(Ft), Height(Ins),
Width(Ft), and Width(Ins). I have a Label Caption that I use to combine the
results of what was entered in the 4 textboxes when I click a command button.
For some reason when I enter 1 in the Width(Ins) Textbox the label will show
1.0625" instead of 1".
Public Sub Preview()
Dim height As Double
Dim width As Double
Dim Hft As Double
Dim Hins As Double
Dim Wft As Double
Dim Wins As Double
Dim Face As String
'result of which face was selected on userform
If optSingleFace = True Then
Face = optSingleFace.Caption
Else
Face = optDoubleFace.Caption
End If
height = Val(tbxHeightFt) + Val(tbxHeightIns) / 12 'face height in ft
MsgBox height
width = Val(tbxWidthFt) + Val(tbxWidthIns) / 12 'face width in ft
MsgBox width
'dimensions of cabinet in feet & inches
Hft = Int(height)
MsgBox Hft
Hins = WorksheetFunction.Ceiling((height - Hft) * 12, 0.0625)
MsgBox Hins
Wft = Int(width)
MsgBox Wft
Wins = WorksheetFunction.Ceiling((width - Wft) * 12, 0.0625)
MsgBox (Wins)
'Preview Line 1: Single/Double Face, Extruded Cabinet: Dimensions
lblPreview1.Caption = Face & ", Extruded Cabinet: " & Hft & "'-" & Hins
& "'' H x " & Wft & "'-" & Wins & "'' W x " & Val(tbxDepthIns) & "'' D"
End Sub
Thanks, Ryan
Width(Ft), and Width(Ins). I have a Label Caption that I use to combine the
results of what was entered in the 4 textboxes when I click a command button.
For some reason when I enter 1 in the Width(Ins) Textbox the label will show
1.0625" instead of 1".
Public Sub Preview()
Dim height As Double
Dim width As Double
Dim Hft As Double
Dim Hins As Double
Dim Wft As Double
Dim Wins As Double
Dim Face As String
'result of which face was selected on userform
If optSingleFace = True Then
Face = optSingleFace.Caption
Else
Face = optDoubleFace.Caption
End If
height = Val(tbxHeightFt) + Val(tbxHeightIns) / 12 'face height in ft
MsgBox height
width = Val(tbxWidthFt) + Val(tbxWidthIns) / 12 'face width in ft
MsgBox width
'dimensions of cabinet in feet & inches
Hft = Int(height)
MsgBox Hft
Hins = WorksheetFunction.Ceiling((height - Hft) * 12, 0.0625)
MsgBox Hins
Wft = Int(width)
MsgBox Wft
Wins = WorksheetFunction.Ceiling((width - Wft) * 12, 0.0625)
MsgBox (Wins)
'Preview Line 1: Single/Double Face, Extruded Cabinet: Dimensions
lblPreview1.Caption = Face & ", Extruded Cabinet: " & Hft & "'-" & Hins
& "'' H x " & Wft & "'-" & Wins & "'' W x " & Val(tbxDepthIns) & "'' D"
End Sub
Thanks, Ryan