VBA won't format into fraction
Here is one, incredibly convoluted way
Dim saveValue
Dim saveFormat
With Range("A1")
saveValue = .Value
saveFormat = .NumberFormat
.Value = TextBox4.Text - 1 / 8
.NumberFormat = "#??/??"
If ListBox2.Value = "H.W.R." Then
Label17.Caption = Format(TextBox4.Text - 1 / 8, "#??/??")
Else
Label17.Caption = TextBox4.Text + 1 / 8
End If
.Value = saveValue
.NumberFormat = saveFormat
End With
--
HTH
Bob Phillips
(remove nothere from the email address if mailing direct)
"damorrison" wrote in message
ups.com...
I have a formula in VBA that is calculated and displayed in a Label,
and then inserted into a cell,
I cannot get the darned thing to display as a Fraction or get it
formatted into the cell as a fraction
Here is the formula
Private Sub ListBox2_Change()
If ListBox2.Value = "H.W.R." Then
Label17.Caption = TextBox4.Text - 1 / 8
Else
Label17.Caption = TextBox4.Text + 1 / 8
End If
End Sub
Any Ideas
|