ensuring only numbers are entered

drdre77

New Member
Joined
Dec 27, 2017
Messages
13
Hi. This is what I got, it works like I want it except for when it's to enter retail price and contractor pricing. what I would want it to do is make sure whoever enters the item and price that they enter it properly... and numbers only... so if they were to enter an item with the $ sign or with two decimal points or commas or like mistakes like that... I want it to have them correct it in the proper dollar pricing format... like 9.99 or 10.49 etc.

wondering if someone can help me with a fix here.
Thanks
Andre

Sub Graphic6_Click()
Reply = InputBox(Prompt:="ITEM SKU", _
Title:="ITEM SKU", Default:="")
If Reply = vbNullString Then

Else
ActiveSheet.Range("AA11").Value = Reply
End If
If ActiveSheet.Range("aa14").Value = 0 Then
ActiveSheet.Range("aa11").Value = Reply
Else
MsgBox "DUPLICATE ITEM NUMBER"
End
End If
Reply = InputBox(Prompt:="DESCRIBE THE PRODUCT", _
Title:="PRODUCT DESCRIPTION", Default:="")
If Reply = vbNullString Then

Else
ActiveSheet.Range("AB11").Value = Reply
End If
Reply = InputBox(Prompt:="ENTER RETAIL PRICE", _
Title:="PRICE", Default:="$.$$")
If Reply = vbNullString Then

Else
ActiveSheet.Range("AC11").Value = Reply
End If
Reply = InputBox(Prompt:="INPUT WHAT CONTRACTOR PAYS", _
Title:="CONTRACTOR PRICE", Default:="$.$$")
If Reply = vbNullString Then

Else
ActiveSheet.Range("AD11").Value = Reply
End If
If MsgBox("IS ALL THE INFORMATION ACCURATE? WANT TO SUBMIT?", vbYesNo) = vbNo Then Exit Sub
Worksheets("New Invoice Tool").Range("aa11:aD11").Copy
Worksheets("PRODUCT PAGE").Cells(Rows.Count, "a").End(xlUp).Offset(1, 0).PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Worksheets("New Invoice Tool").Range("aa11:aD11").Select
Selection.ClearContents

Worksheets("New Invoice Tool").Range("c11").Select
End Sub
 

Excel Facts

Excel motto
Not everything I do at work revolves around Excel. Only the fun parts.
you could test like this

Code:
Sub TestValue()
    Dim reply
    
Pays:
    reply = InputBox(Prompt:="INPUT WHAT CONTRACTOR PAYS" & vbCr & "enter numbers only!", Title:="CONTRACTOR PRICE", Default:="$.$$")
    If Not IsNumeric(reply) Then GoTo Pays
    reply = Format(reply, "0.00")
    MsgBox reply
End Sub
 
Upvote 0

Forum statistics

Threads
1,214,981
Messages
6,122,566
Members
449,089
Latest member
Motoracer88

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