mykal66
05-05-2012, 01:17 AM
I need VBA to look at a range in a workbook A7:A20 for several values that should not be there e.g. xxxx or xxxx or xxxxxxxxx before the sheet can be printed
If any of the values are found within the range then i need the cell to be highlighted and a message-box advising the user to correct the entry before they are allowed to print. I need it to keep checking until they clear all instances on the list
I've tried a few pieces of code from the Internet but cant adapt them to work properly so tried macro recorder and did find...
The macro did work for one value only, highlighted the relevant cell and brought up a message box however, if the value was not found i get an error and it will only look for one value. This is what i have tried last
Cells.Find(What:="xxxx", After:=ActiveCell, LookIn:=xlValues, LookAt:= _
xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=False _
, SearchFormat:=False).Activate
MsgBox ("You cannot print your letter until you amend this phrase")
Can anyone help please
If any of the values are found within the range then i need the cell to be highlighted and a message-box advising the user to correct the entry before they are allowed to print. I need it to keep checking until they clear all instances on the list
I've tried a few pieces of code from the Internet but cant adapt them to work properly so tried macro recorder and did find...
The macro did work for one value only, highlighted the relevant cell and brought up a message box however, if the value was not found i get an error and it will only look for one value. This is what i have tried last
Cells.Find(What:="xxxx", After:=ActiveCell, LookIn:=xlValues, LookAt:= _
xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=False _
, SearchFormat:=False).Activate
MsgBox ("You cannot print your letter until you amend this phrase")
Can anyone help please