WERNER SLABBERT

Board Regular
Joined
Mar 3, 2009
Messages
104
HEllo Folks, Any Idea how i can loop through an input error with my code here? the user should only use numerical but would it be possible for vba not to error out and just simply clear the textbox and have the user retry input?<br>
<br>
Code:
<br>
Private Sub TextBox200_AfterUpdate()<br>
DoUpdate200<br>
End Sub<br>
<br>
<br>
Code:
<br>
Sub DoUpdate200()<br>
If TextBox200.Value = "" Then TextBox200.Value = 0<br>
Sum1.Value = TextBox200.Value * 200<br>
Sum1.Value = Format(Sum1.Value, "Currency")<br>
End Sub<br>
<br>
<br>
As Always i do appreciate all you smart people helping this noob...
Also In An unrelated question, hiw can i have this TextBox display "Currency" Correctly after the user has input the ammount.
Eg: R 4851,29 at the moment the input does not "auto Display the decimal if not entered manually Eg: R 4000
Code:
Private Sub INVtot_Change()
Diff_sum
    INVtot.Value = Format(INVtot.Value, "R ***###,##")
End Sub
PS: The "Currency" Format does not work.
 
Last edited:

Excel Facts

Create a chart in one keystroke
Select the data and press Alt+F1 to insert a default chart. You can change the default chart to any chart type
Any Idea how i can loop through an input error with my code here? the user should only use numerical but would it be possible for vba not to error out and just simply clear the textbox and have the user retry input?
Try this...
Code:
Private Sub TextBox200_AfterUpdate()
    With TextBox200
        If Not IsNumeric(.Value) Then
            .Value = ""
            MsgBox "You must provide a numeric value in this TextBox!"
            Exit Sub
        Else
            DoUpdate200
        End If
    End With
End Sub
 
Upvote 0
can i have this TextBox display "Currency" Correctly after the user has input the amount

try..
Code:
Private Sub INVtot_AfterUpdate()
    INVtot.Value = Format(INVtot.Value, "R #,##0.00")
End Sub
 
Upvote 0
Thank You Yongle
These solutions work Fantastic. as a noob at VBa i amtrying to power through the fact that i know less than a doorknob about coding, but try and fail... so just a quick question, is there a way i can send you a copy of my form for tips and so on. ?

Regards
Joe
 
Upvote 0

Forum statistics

Threads
1,214,553
Messages
6,120,179
Members
448,948
Latest member
spamiki

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