Textboxes

Excel Facts

Repeat Last Command
Pressing F4 adds dollar signs when editing a formula. When not editing, F4 repeats last command.
Gene

It depends what you mean really.

You could use a textbox to type in something like 1/2 then use code to interpret that as 0.5.
 
Upvote 0
Gene

It depends what you mean really.

You could use a textbox to type in something like 1/2 then use code to interpret that as 0.5.

The user will not be typing it in. I want the userform to generate 2 fractions to be displayed - and then the user will choose the larger.

Gene, "The Mortgage Man", Klein
 
Upvote 0
I know Native Excel has a format for this - I was wondering if Userforms have the same capability.

Gene, "The Mortgage Man", Klein
 
Upvote 0
Gene

Why are you using textboxes if there's going to be no user input? Why not use labels?

Also why not load the fractions from a worksheet using the Text property of a cell. That returns the value in the cell as it's formatted on the sheet, though I'm not 100% sure how it would work with the Fraction format.

I'll have a look into it and post back.
 
Upvote 0
Gene

Why are you using textboxes if there's going to be no user input? Why not use labels?

Also why not load the fractions from a worksheet using the Text property of a cell. That returns the value in the cell as it's formatted on the sheet, though I'm not 100% sure how it would work with the Fraction format.

I'll have a look into it and post back.


If you are saying that I could format values less than one as fractions in Native Excel (which I know) and then transfer that format into a label on a userform - that would be perfect. I would I do this?

Gene, "The Mortgage Man", Klein
 
Upvote 0
Gene

Here's an example.

Put 0.6 in a cell, say A1.

Format that cell as a Fraction, as required.

Then use this code.
Code:
Label1.Caption = Range("A1").Text
I'm not 100% sure how you'll be able to use this in the rest of the code.

You'll somehow need to change it back to a value, if you want to compare it to other values.
 
Upvote 0
I'm not 100% sure how you'll be able to use this in the rest of the code.

You'll somehow need to change it back to a value, if you want to compare it to other values.

Ah - so you are saying that when I "copy" it into the label, I am only taking the format, not the value. I suppose I can get around this by keeping track of the value "underneath" in excel - but it seems like duplication. Native Excel can keep a fraction value and format in a cell, why can't a Userform keep it in a label or textbox?

Gene, "The Mortgage Man", Klein
 
Upvote 0

Forum statistics

Threads
1,214,913
Messages
6,122,207
Members
449,074
Latest member
cancansova

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top