PDA

View Full Version : [SOLVED] Can you Format as fraction in VBA -- Format(123.456, "# ??/16")



Paul_Hossler
05-14-2018, 07:38 AM
This is an extract of larger project

Simplified it to just experiment in immediate window to try and get it to work

I put 123.456 in A1, and formatted it using the Format, Number, Fraction, As Sixteenths

Displays correctly on worksheet as 123 7/16

When I try to Format() it internally as part of a string, I get 123 ??/16



?activecell.NumberFormat
# ??/16

?format(123.456, "# ??/16")
123 ??/16



Does Format() work with fraction formats?

Paul_Hossler
05-14-2018, 07:14 PM
Found an answer - Format () for fractions doesn't work, but Application.WorksheetFunction.Text () does




?application.WorksheetFunction.Text(123.456, "# ??/16")
123 7/16