U can use on error goto msg

msg: Inputbox()

On Dec 13, 9:52 am, Raj Mahapatra <rajafs...@gmail.com> wrote:
> hi Vaibhav,
>
> thanks for this.
>
> but i want to dispaly an input box as "*lookfor is not in the rng*" while
> there is error.
>
>
>
> On Fri, Dec 10, 2010 at 1:32 PM, <in.vaib...@gmail.com> wrote:
> > Hi,
>
> > Add line;
>
> > On error resume next
>
> > Rgds
> > Vaibhav J
>
> > Sent on my BlackBerry® from Vodafone
> > ------------------------------
> > *From: *Raj Mahapatra <rajafs...@gmail.com>
> > *Sender: *excel-mac...@googlegroups.com
> > *Date: *Fri, 10 Dec 2010 10:02:19 +0530
> > *To: *<excel-macros@googlegroups.com>
> > *ReplyTo: *excel-mac...@googlegroups.com
> > *Subject: *$$Excel-Macros$$ Vlookup in Macro
>
> > hi group,
>
> > In the following vlookup code in macro, if any object is #N/A in the rng
> > then "*run time error 1004*"occurs.  In such case, i want that it should
> > show a message as "*lookfor data is not in the range"*
>
> > help me how to put msg box if lookfor is not in the rng.
>
> > Sub vlookup()
> > Dim lookfor As Range
> > Dim rng As Range
> > Dim col As Integer
>
> > Set lookfor = ActiveCell.Offset(0, 2)
> >     Set rng = Sheets("MV").Columns("A:C")
> >     col = 3
>
> >     dept_code = Application.WorksheetFunction.vlookup(lookfor, rng, col, 0)
> > End Sub
> > Thanks & Regards
>
> > Rajesh Mahapatra
>
> > --
>
> > ---------------------------------------------------------------------------­-------
> > Some important links for excel users:
> > 1. Follow us on TWITTER for tips tricks and links :
> >http://twitter.com/exceldailytip
> > 2. Join our LinkedIN group @http://www.linkedin.com/groups?gid=1871310
> > 3. Excel tutorials athttp://www.excel-macros.blogspot.com
> > 4. Learn VBA Macros athttp://www.quickvba.blogspot.com
> > 5. Excel Tips and Tricks athttp://exceldailytip.blogspot.com
>
> > To post to this group, send email to excel-macros@googlegroups.com
>
> > <><><><><><><><><><><><><><><><><><><><><><>
> > Like our page on facebook , Just follow below link
> >http://www.facebook.com/pages/discussexcelcom/160307843985936?v=wall&;...
>
> > --
>
> > ---------------------------------------------------------------------------­-------
> > Some important links for excel users:
> > 1. Follow us on TWITTER for tips tricks and links :
> >http://twitter.com/exceldailytip
> > 2. Join our LinkedIN group @http://www.linkedin.com/groups?gid=1871310
> > 3. Excel tutorials athttp://www.excel-macros.blogspot.com
> > 4. Learn VBA Macros athttp://www.quickvba.blogspot.com
> > 5. Excel Tips and Tricks athttp://exceldailytip.blogspot.com
>
> > To post to this group, send email to excel-macros@googlegroups.com
>
> > <><><><><><><><><><><><><><><><><><><><><><>
> > Like our page on facebook , Just follow below link
> >http://www.facebook.com/pages/discussexcelcom/160307843985936?v=wall&...- 
> >Hide quoted text -
>
> - Show quoted text -

-- 
----------------------------------------------------------------------------------
Some important links for excel users:
1. Follow us on TWITTER for tips tricks and links : 
http://twitter.com/exceldailytip
2. Join our LinkedIN group @ http://www.linkedin.com/groups?gid=1871310
3. Excel tutorials at http://www.excel-macros.blogspot.com
4. Learn VBA Macros at http://www.quickvba.blogspot.com
5. Excel Tips and Tricks at http://exceldailytip.blogspot.com
 
To post to this group, send email to excel-macros@googlegroups.com

<><><><><><><><><><><><><><><><><><><><><><>
Like our page on facebook , Just follow below link
http://www.facebook.com/pages/discussexcelcom/160307843985936?v=wall&ref=ts

Reply via email to