ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Use a formula to populate a label from a textbox (https://www.excelbanter.com/excel-discussion-misc-queries/108255-use-formula-populate-label-textbox.html)

damorrison

Use a formula to populate a label from a textbox
 
I am tryin to caption a label from this textbox with no luck

Label1.Caption = (Round(TextBox1 / 0.03125, 0) * 0.03125)


the the label has to be formated like this
# ??/??


Dave Peterson

Use a formula to populate a label from a textbox
 
maybe:

Label1.Caption _
= Application.Text(Round(textbox1.value / 0.03125, 0) * 0.03125, "# ??/??")


damorrison wrote:

I am tryin to caption a label from this textbox with no luck

Label1.Caption = (Round(TextBox1 / 0.03125, 0) * 0.03125)

the the label has to be formated like this
# ??/??


--

Dave Peterson

damorrison

Use a formula to populate a label from a textbox
 
Hi Dave,
I am getting a type mismatch error

Label1.Caption _
= Application.Text(Round(textbox1.value / 0.03125, 0) * 0.03125, "#
??/??")


Dave Peterson

Use a formula to populate a label from a textbox
 
I'm betting that what you have in textbox1 isn't a number (or doesn't look like
a number).

if isnumeric(textbox1.value) then
Label1.Caption _
= Application.Text(Round(textbox1.value / 0.03125, 0) * 0.03125, "# ??/??")
else
Label1.Caption = "not a number in textbox1"
end if



damorrison wrote:

Hi Dave,
I am getting a type mismatch error

Label1.Caption _
= Application.Text(Round(textbox1.value / 0.03125, 0) * 0.03125, "#
??/??")


--

Dave Peterson

damorrison

Use a formula to populate a label from a textbox
 
Thanks dave,
Yes the problem was,
as soon as I hit the decimal the type mismatch error kicked in thanks
alot


damorrison

Use a formula to populate a label from a textbox
 

When entering into the textbox,
is it possible to enter as fractions and decimals, when I enter as
fractions it becomes a non-number



All times are GMT +1. The time now is 01:36 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com