Text box userform question

Dtex20

Board Regular
Joined
Jan 29, 2018
Messages
50
Hi,

I've encountered something, i have a userform with a text box and on every computer on my network it allows for Currency variable to take on the value placed into a text box.

Public recSaleCheck As Currency
Public machineCheck As Currency

Code:
'Puts the value of where the row and column intersect into the AgentCostBox,  base price.Me.AgentCostBox.Value = ws.Cells(baseRow, basecol).Value
Me.AgentRecSalePrice.Value = ws.Cells(baseRow, baseSellCol).Value


Me.AgentCostBox.Value = Format(AgentCostBox, "£#,##0.00")
Me.AgentRecSalePrice.Value = Format(AgentRecSalePrice, "£#,##0.00")

Now on 1 computer on excel 2013, for whatever reason it will not allow the following code (below) to execute i get a 'type mismatch':

Code:
machineCheck = Me.AgentCostBox.Value
recSaleCheck = Me.AgentRecSalePrice.Value

I have no idea why it is doing this, i tested it on 30+ computers and it works. From office 2010 to 365 premium, but this one computer it gives me type mismatch. The only thing i got to work is by converting to a string?

Any ideas.. Thanks
 

Excel Facts

Best way to learn Power Query?
Read M is for (Data) Monkey book by Ken Puls and Miguel Escobar. It is the complete guide to Power Query.
Hi,
what comes out of your textbox is Text which probably explains your error - to ensure that values are of correct data type use a Type conversion function and see if this resolves your issue

Rich (BB code):
machineCheck = Val(Me.AgentCostBox.Value)
recSaleCheck = Val(Me.AgentRecSalePrice.Value)

Val function is a bit more forgiving than other functions as it returns zero (0) for invalid data entries whereas other functions will error which you would need to manage.
However do note that Val function only recognizes the period (.) as a valid decimal separator. If different decimal separators are to be used then use CDbl to convert your string to a number.

Dave
 
Upvote 0

Forum statistics

Threads
1,215,968
Messages
6,127,983
Members
449,414
Latest member
sameri

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