Error Trap Needed

torweb

Board Regular
Joined
Dec 1, 2003
Messages
136
Ok..I've tried several time to get something working here. I'm looking to insert an error trap that will display a msg that "The number of entries has been exceeded" This will happen when the user tries to build something with more that 40 lines of entries. I've pasted the section of code where I think it should go...any input will insure good Karma!! :biggrin:

Application.ScreenUpdating = False
With Sheets("RecipeCard")
.Range("A12:F60").Value = Sheets("RecipeTracker").Range("P11:U300").Value
With .Range("A12:A60")
.Replace What:="0", Replacement:="", LookAt:=xlWhole
.SpecialCells(xlBlanks).EntireRow.Delete

End With
End With
 

Some videos you may like

Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.

SIXTH SENSE

Well-known Member
Joined
Oct 29, 2003
Messages
1,883
hi!
im not sure if A column is the reciept number that shoud not exceeed 40.
if so try this
Code:
if application.worksheetfunction.countA(range("a12:a60"))>40 then msgbox "you are over the limit of 40"
 

torweb

Board Regular
Joined
Dec 1, 2003
Messages
136
Hey Hey...Sixth Sense. Good Call.

Now if I could, what can I do to send them back to revise their entries? The pop-up msg worked great, but it would be nice to send the back to revise the quantity of entries.

Please exucse me for not trying to muscle through this...but I've been working on this workbook since December 2003 and I think my brain is falling apart.

Thanks....!
 

SIXTH SENSE

Well-known Member
Joined
Oct 29, 2003
Messages
1,883
ok!
Code:
if application.worksheetfunction.countA(range("a12:a60"))>40 then 
msgbox "you are over the limit of 40"  & chr(13) & "do it again please"
goto r   ' r is a label you wan the user to go back or have him 
               exit the procedure
exit sub 'slect between the two.
 

Watch MrExcel Video

Forum statistics

Threads
1,122,233
Messages
5,594,963
Members
413,954
Latest member
mrsandy

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
Top