TextBox export back to worksheet as number (%)

drynka

New Member
Joined
Oct 24, 2018
Messages
3
Hi,

I have got very difficult issue for me and cannot handle it myself :-(
Hope experts here can help me.
First of all I need to say that I am not good in VB, I am doing sth only from time to time only using hints and manuals.
Now I did sth which is very helpful for me, a user form which retrieves data from a worksheet (numbers, usually %), shows them in textboxes in UserForm, where I can change the numbers, correct them, click another button and save/overwrite the worksheet with new/updated number (usually % "0.00%").

So I have done one macro for retrieving data from the worksheet to UserForm:
UserForm1.FirstTextBOX = Format(Sheets("database").Range("Data_Start").Offset(TargetRaw, 63).Value, "Percent")

data appear in the UserForm in a proper % format
I update it and click save initiating another macro working other way around:

Sheets("database").Range("Data_Start").Offset(TargetRaw, 63).Value = UserForm1.FirstTextBOX

It updates the database in the cell I want and the value I entered but it in a TEXT format.
I need it to be updated in Number format because it destroys all formulas I have, does not calculate anything with text :-(

I have tried to export data back to the database with
Format (Sheets("database").Range("Data_Start").Offset(TargetRaw, 63).Value, "Percent") = UserForm1.FirstTextBOX
but it does not work at all.

What can I do to solve it? should I somehow change the textbox properties?
How I should write the export macro to have a number format in worksheet?
Can somebody help me?
really appreciated.

E.
 

Excel Facts

Round to nearest half hour?
Use =MROUND(A2,"0:30") to round to nearest half hour. Use =CEILING(A2,"0:30") to round to next half hour.
You need to convert the text in the textbox to a number, and since it's a percentage you'll probably want to divide it by 100, try this.
Code:
Sheets("database").Range("Data_Start").Offset(TargetRaw, 63).Value = Replace(UserForm1.FirstTextBOX, "%", "")/100
 
Upvote 0

Forum statistics

Threads
1,223,246
Messages
6,170,996
Members
452,373
Latest member
TimReeks

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