how to make it go back instead of kicking you out?

drdre77

New Member
Joined
Dec 27, 2017
Messages
13
This is part of my formula. So it's a box I click on... I enter Supplier name, department, and information of the supplier first... and then eventually ITEM# or SKU# Now, what I added was in between END IF and END in RED. Because I didn't want to have duplicate item numbers in my system. What it does is that it looks up to see if the same SKU# exists in the product page sheet... if it does, I return a value 1 otherwise 0. If it's 0, it means there's no duplicates, which then goes on prompting for other information such as price etc... BUT, if it does have duplicate, a message pops up saying duplicate, SKU and then only option is O.K. and it kicks you out to start over again.... but the problem is, that the supplier information entered before has to be re-entered again... it's possible to have multiple items from same supplier, so it's a bit frustrating to start all over again.... so, what I would like is that if it find a duplicate SKU, it tells you, but let's you correct it or change the number. Something like... Duplicate SKU, try again...
Is that possible please?


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 = ID
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:="SUGGESTED SELLING PRICE", _
Title:="PRICE", Default:="")
If Reply = vbNullString Then

Else
ActiveSheet.Range("AC11").Value = Reply
 

Excel Facts

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.
how would I modify my above formula? I haven't played with excel in a while... my memory is coming back, but it's frustrating when it doesn't work lol thanks
 
Upvote 0
If you want the function/subroutine to stop right after displaying msgbox about duplicate, then use Exit Sub (or Exit Function) instead of End.

Or to execute certain other code segment within the subroutine after displaying message box, assign label name to a line and use GoTo myLineLabel to jump to that. Or restructure your If statement to include all those statements.

I had included documentation of all three keywords is in my post earlier (hyperlinks) for your reference.
 
Upvote 0

Forum statistics

Threads
1,224,820
Messages
6,181,160
Members
453,021
Latest member
Justyna P

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