View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
[email protected] kmzito@gmail.com is offline
external usenet poster
 
Posts: 9
Default Adding Options When User Cancels/Cannot Find

Hi everyone,

Much thanks in advance for any help.

I'm putting together the two below macros. The first to ask the user
for a vendor name, and then it searches (easy enough!). When I search
for a vendor that is not there, I get an error to debug. I'd like an
error box to pop up. I just learned userforms today so I'm thinking
maybe that would work as an option? Any advice would be greatly
appreciated.

(1)*********

Dim sUsername As String
Dim sPrompt As String
sPrompt = "Please enter vendor name"
sUsername = InputBox(sPrompt, sTitle, sDefault)

Sheets("list").Select
Range("C2").Select
Cells.Find(What:=sUsername, After:=ActiveCell, LookIn:=xlFormulas,
LookAt _
:=xlPart, SearchOrder:=xlByColumns, SearchDirection:=xlNext,
MatchCase:= _
False, SearchFormat:=False).Select