i have search function in vba code searches column a. column filled acronyms , corresponding rows in column b meanings acronym.
i have user form setup user can enter acronym , if in file, show message box saying acronym means.
i trying search exact match of acronym user enters, via line:
range("a:a").find(acro, lookat = xlwhole).select however, when run it, if copy cell containing acronym , paste user form text box, act if not find , follows on error handle.
what did wrong made unable find acronym string looking for?
thank you!
@nwhaught answered , pointed out real issue, add large comment:
it's best not chain select/activate directly find():
range("a:a").find(acro, lookat = xlwhole).select ...since requires error handling when item not found (and discovered can mask other issues code)
try instead:
dim f set f = range("a:a").find(acro, lookat := xlwhole) if not f nothing 'do f end if the is nothing test avoids use of error handling.
Comments
Post a Comment