Textboxes

Norie

Well-known Member
Joined
Apr 28, 2004
Messages
75,275
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.
 

mortgageman

Well-known Member
Joined
Jun 30, 2005
Messages
2,015
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
 

mortgageman

Well-known Member
Joined
Jun 30, 2005
Messages
2,015
I know Native Excel has a format for this - I was wondering if Userforms have the same capability.

Gene, "The Mortgage Man", Klein
 

Norie

Well-known Member
Joined
Apr 28, 2004
Messages
75,275
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.
 

mortgageman

Well-known Member
Joined
Jun 30, 2005
Messages
2,015
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
 

Norie

Well-known Member
Joined
Apr 28, 2004
Messages
75,275
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.
 

mortgageman

Well-known Member
Joined
Jun 30, 2005
Messages
2,015
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
 

Forum statistics

Threads
1,077,831
Messages
5,336,655
Members
399,094
Latest member
Learner2019

Some videos you may like

This Week's Hot Topics

Top