Lectricman
New Member
- Joined
- Feb 18, 2016
- Messages
- 14
Long time no see.
I am having a nightmare trying to get data from a textbox to a cell in a number format.
I have tried just about every tip and trick on the net and either my vba is wrong or I'm being a bit dense.
I have several combo and text boxes on a user form and only one of them needs to be in a number format.
So how do I get the data from txtQuantity1 into a cell in a usable number format. Once all the data is entered the user presses a button and the data is transfered to a worksheet and the form is cleared ready to be used again. Everthing works fine and dandy apart from the formatting of txtQuantity1.
Many, many thanks in advance.
I am having a nightmare trying to get data from a textbox to a cell in a number format.
I have tried just about every tip and trick on the net and either my vba is wrong or I'm being a bit dense.
Code:
With Worksheets(SheetName)
.Cells(iRow, 1).Value = Me.txtWhen.Value
.Cells(iRow, 4).Value = txtShift1
.Cells(iRow, 2).Value = Me.txtLocation.Value
.Cells(iRow, 3).Value = txtOperator
.Cells(iRow, 5).Value = txtOrders
.Cells(iRow, 6).Value = txtWhat1
.Cells(iRow, 7).Value = txtQuantity1
.Cells(iRow, 7).NumberFormat = "#,##0"
.Cells(iRow, 8).Value = cbUnits1
.Cells(iRow, 9).Value = txtComment
End With
I have several combo and text boxes on a user form and only one of them needs to be in a number format.
So how do I get the data from txtQuantity1 into a cell in a usable number format. Once all the data is entered the user presses a button and the data is transfered to a worksheet and the form is cleared ready to be used again. Everthing works fine and dandy apart from the formatting of txtQuantity1.
Many, many thanks in advance.