Guarantee format when placing information back to a sheet from userform.

finaljustice

Board Regular
Joined
Oct 6, 2010
Messages
175
Hi there,

I am having issues when putting information back into spreadsheets from information coming from Userforms. Mainly the data i'm "pasting" back into cells are being interpreted as text when they should be numbers, even though I have tried to formatting the data before putting it back into the sheet.

Here is an example:

Code:
Sub SaveSteel_2() 'saves the steeel that is about to be registered
Application.ScreenUpdating = False


'find last row occupied.
UltL = ThisWorkbook.Worksheets("Acos").Range("A" & Rows.Count).End(xlUp).Row + 1


For i = 1 To 36


If i = 1 Then


    ThisWorkbook.Sheets("Acos").Range("A" & UltL).Offset(0, i - 1) = UserForm3.Controls("Textbox" & i) 'added this because the first item is the name of the steel and is text but the rest must be placed back as numbers, ergo the IF.
    GoTo SkipName2
    End If
    ThisWorkbook.Sheets("Acos").Range("A" & UltL).Offset(0, i - 1) = Format(UserForm3.Controls("Textbox" & i), "0.00")
SkipName2:
Next


'refresh the combobox with the new steel.
UltL = ThisWorkbook.Worksheets("Acos").Range("A" & Rows.Count).End(xlUp).Row
ThisWorkbook.Sheets("Acos").Range("A3:A" & UltL).Name = "lista_acos"
UserForm1.ComboBox1.RowSource = "lista_acos"




MsgBox "Registration was successful!"
UserForm3.Hide




Application.ScreenUpdating = True
End Sub


I would really appreciate if someone could help me figure what I have been doing wrong.

Thanks

Luis
 

Excel Facts

Pivot Table Drill Down
Double-click any number in a pivot table to create a new report showing all detail rows that make up that number

Forum statistics

Threads
1,215,053
Messages
6,122,882
Members
449,097
Latest member
dbomb1414

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