Macro to find a number

harshab6

Active Member
Joined
Oct 1, 2008
Messages
254
Hi,

I need a macro to pick a number from cell R20 go sheet name data find that number and if number is found give a msg box as number found.

Thanks and Regards,

Harsha
 

Excel Facts

Easy bullets in Excel
If you have a numeric keypad, press Alt+7 on numeric keypad to type a bullet in Excel.
Hi, try:

Code:
Sub m()
Dim r As Range
Set r = Sheets("Data").Cells.Find(Range("R20").Value, LookIn:=xlValues, LookAt:=xlWhole)
If Not r Is Nothing Then
    MsgBox "Number Found"
        Else
    MsgBox "Number Not found"
End If
End Sub
 
Upvote 0
Hi FormR ,

Thanks for the Reply.I should have been bit specific.There are 2 sheets in my workbook summary sheet and data sheet.I want the macro which should pick the number from cell R20 and find the same in Data sheet and display a msg number found.

Thanks and Regards,
Harsha
 
Upvote 0
Rich (BB code):
Sub m()
Dim r As Range
Set r = Sheets("Data").Cells.Find(Sheets("Summary").Range("R20").Value, LookIn:=xlValues, LookAt:=xlWhole)
If Not r Is Nothing Then
    MsgBox "Number Found"
        Else
    MsgBox "Number Not found"
End If
End Sub
 
Upvote 0

Forum statistics

Threads
1,203,605
Messages
6,056,231
Members
444,852
Latest member
MJaspering

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
Back
Top