ipbr21054
Well-known Member
- Joined
- Nov 16, 2010
- Messages
- 6,150
- Office Version
- 2024
- Platform
- Windows
Hi,
On my userform i have TextBox4 which i would like that when i enter 15 into it then i should see £15.00
I am using this code shown below but it only changes the 15 to £15
Once i use the command button to send values from userform to worksheet i need that value on the worksheet to also show the currency format like so £15.00 etc
This is the code in use for the transfer from userform to worksheet.
TextBox4 value will be placed into the cell at column Q
Please advise.
Many Thanks
On my userform i have TextBox4 which i would like that when i enter 15 into it then i should see £15.00
I am using this code shown below but it only changes the 15 to £15
Rich (BB code):
Private Sub TextBox4_Change()
TextBox4 = UCase(TextBox4)
TextBox4.Value = Format(TextBox4.Value, "£###,##")
End Sub
Once i use the command button to send values from userform to worksheet i need that value on the worksheet to also show the currency format like so £15.00 etc
This is the code in use for the transfer from userform to worksheet.
Rich (BB code):
Private Sub CommandButton1_Click()
Dim i As Long, x As Long
Dim LastRow As Long
With Sheets("G INCOME")
If TextBox1.Value = "" Then
MsgBox "NO CUSTOMER'S NAME WAS ENTERED", vbCritical, "NAME & ADDRESS EMPTY MESSAGE"
TextBox1.SetFocus
Exit Sub
ElseIf TextBox2.Value = "" Then
MsgBox "NO ADDRESS WAS ENTERED", vbCritical, "NAME & ADDRESS EMPTY MESSAGE"
TextBox2.SetFocus
Exit Sub
ElseIf TextBox3.Value = "" Then
MsgBox "NO POST CODE WAS ENTERED", vbCritical, "NAME & ADDRESS EMPTY MESSAGE"
TextBox3.SetFocus
Exit Sub
ElseIf TextBox4.Value = "" Then
MsgBox "NO CHARGE WAS ENTERED", vbCritical, "NAME & ADDRESS EMPTY MESSAGE"
TextBox4.SetFocus
Exit Sub
ElseIf TextBox5.Value = "" Then
TextBox5.SetFocus
MsgBox "NO MILEAGE WAS ENTERED", vbCritical, "NAME & ADDRESS EMPTY MESSAGE"
Exit Sub
End If
LastRow = .Cells(Rows.Count, "N").End(xlUp).Row + 1
Application.ScreenUpdating = False
For i = 1 To 5
.Cells(LastRow, i + 13).Value = Me.Controls("TextBox" & i).Value
Next i
With .Cells(LastRow, 14).Resize(, 5)
.Font.Name = "Calibri"
.Font.Size = 11
.Font.Bold = True
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlCenter
.Borders.Weight = xlThin
.Interior.ColorIndex = 6
End With
.Cells(LastRow, "N").HorizontalAlignment = xlLeft
Application.ScreenUpdating = True
If .AutoFilterMode Then .AutoFilterMode = False
x = .Cells(Rows.Count, 4).End(xlUp).Row
.Range("N4:R" & x).Sort Key1:=.Range("N4"), Order1:=xlAscending, Header:=xlGuess
Unload AddCustomer
MsgBox "DATABASE SUCCESSFULLY UPDATED", vbInformation, "GRASS INCOME NAME & ADDRESS MESSAGE"
.Range("N4").Select
End With
End Sub
TextBox4 value will be placed into the cell at column Q
Please advise.
Many Thanks