Hi all. I have a test userform called Userform2
On the userform I have the a textbox called txbAmount. once a user has entered an amount into the textbox I want it to show as the UK currency. I have accomplished this with the following After Update code.
I then want to write it to a worksheet table so that when its written Excel see's it as a currency and allows me to reference the cell for calculations ect. This is where I am getting stuck as no matter what I've tried It always writes the amount as text and indents it to the left on the worksheet.
I've tried so many different ways to get this to write to the sheet as currency NumberFormat, .value, etc but I've actually forgotten what I've tried and become over confused, so the code below is what I started with (taken from a backup of the workbook)
(There are other textboxes on the userform date's, notes etc that are written to the sheet in various columns hence this line writing to Col 8)
Would someone be able to let me know what I'm doing wrong please and how to get whatever amount a user enters on the userform to show on the worksheet as currency.
Many thanks
Paul
On the userform I have the a textbox called txbAmount. once a user has entered an amount into the textbox I want it to show as the UK currency. I have accomplished this with the following After Update code.
VBA Code:
txbAmount = Format(txbAmount.text, "£#,##0.00")
I then want to write it to a worksheet table so that when its written Excel see's it as a currency and allows me to reference the cell for calculations ect. This is where I am getting stuck as no matter what I've tried It always writes the amount as text and indents it to the left on the worksheet.
I've tried so many different ways to get this to write to the sheet as currency NumberFormat, .value, etc but I've actually forgotten what I've tried and become over confused, so the code below is what I started with (taken from a backup of the workbook)
VBA Code:
Private Sub cmbWrite_Click()
Dim newRow As Long
With sh1Test
newRow = .Cells(.Rows.Count, 1).End(xlUp).row + 1
.Cells(newRow, 8).Value = txbAmount.Value
End With
End Sub
(There are other textboxes on the userform date's, notes etc that are written to the sheet in various columns hence this line writing to Col 8)
Would someone be able to let me know what I'm doing wrong please and how to get whatever amount a user enters on the userform to show on the worksheet as currency.
Many thanks
Paul