format fractions in VBA

  • Thread starter Thread starter Eldon Lehman
  • Start date Start date
E

Eldon Lehman

Is there an undocumented method of formatting numbers in textboxes as
fractions instead of decimals. Excel uses:
.NumberFormat = "# ??/16"
to get to the closest sixteenth. If none is available I will use a
Select Case to change the text display since only a few are needed to
show drill bit size increments through one inch.
Thank you,
Eldon
 
Eldon Lehman said:
Is there an undocumented method of formatting numbers in textboxes as
fractions instead of decimals. Excel uses:
.NumberFormat = "# ??/16"
to get to the closest sixteenth. If none is available I will use a

No (and a pity, too).

But you could creat a list or table in Excel then copy/paste special/link it to
PowerPoint and get the benefit of Excel's formatting.
 
Eldon Lehman said:
.NumberFormat = "# ??/16"

On further thought, it occurred to me that something like this might do it:

Sub PracticeDrill()

Dim DrillGauge As Double
DrillGauge = 1.25


MsgBox Format(Int(DrillGauge), "#") _
& " and " _
& (DrillGauge - Int(DrillGauge)) / (1 / 16) _
& "/16"


End Sub
 
Steve Rindsberg said:
On further thought, it occurred to me that something like this might do it:

Sub PracticeDrill()

Dim DrillGauge As Double
DrillGauge = 1.25


MsgBox Format(Int(DrillGauge), "#") _
& " and " _
& (DrillGauge - Int(DrillGauge)) / (1 / 16) _
& "/16"


End Sub

Steve, that worked perfectly. I don't speak variables as fluently as
you do, but always look forward to an opportunity to see how they can
make code work so efficiently.
Many Thanks!
 
Glad to help, Eldon.


Steve, that worked perfectly. I don't speak variables as fluently as
you do, but always look forward to an opportunity to see how they can
make code work so efficiently.
Many Thanks!
 
Back
Top