Textboxes

Norie

Well-known Member
Joined
Apr 28, 2004
Messages
75,362
Office Version
365
Platform
Windows
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,362
Office Version
365
Platform
Windows
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,362
Office Version
365
Platform
Windows
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,082,126
Messages
5,363,315
Members
400,725
Latest member
excelingtolearn

Some videos you may like

This Week's Hot Topics

  • populate from drop list with multiple tables
    Hi All, i have a drop list that displays data, what i want is when i select one of those from the list to populate text from different tables on...
  • Find list of words from sheet2 in sheet1 before a comma and extract text vba
    Hi Friends, Trying to find the solution on my task. But did not find suitable one to the need. Here is my query and sample file with details...
  • Dynamic Formula entry - VBA code sought
    Hello, really hope one of you experts can help with this - i've spent hours on this and getting no-where. .I have a set of data (more rows than...
  • Listbox Header
    Have a named range called "AccidentsHeader" Within my code I have: [CODE]Private Sub CommandButton1_Click() ListBox1.RowSource =...
  • Complex Heat Map using conditional formatting
    Good day excel world. I have a concern. Below link have a list of countries that carries each country unique data. [URL...
  • Conditional formatting
    Hi good morning, hope you can help me please, I have cells P4:P54 and if this cell is equal to 1 then i want row O to say "Fully Utilised" and to...
Top