Fractions displayed in cells, Why not in user forms?

G

Guest

I'm able to display fractions nicely in Excel cells, for example 0.315 as
1/32, etc...
but I can't do the same thing in userform textboxes. Those at my company
prefer seeing fractions to seeing decimals, so I'd like to display fractions
in the user forms they use.

Is there the equivalent of "Format Cells..." for User forms? Excel clearly
has this routine tucked within it...but I can't seem to access it where I
need it.

-Tony
 
D

Dave Peterson

You can use something like this:

dim SomeVar as double
somevar = 0.315
Me.TextBox1.Text = Application.Text(somevar, "#/##")
 
G

Guest

Dave,

Thank you very much, that solves the problem for me. It's good to
understand now what the difference between the .text and .value properties of
cells are. No doubt this means I must manipulate the textbox values as text
at that point.

Thanks again,
-Tony
 
D

Dave Peterson

And you may have to do some conversion to numbers if you want to use the
textbox.text in calculations.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top