Hi Group,
I need some help.
I have a number being input in Sheet1, which I have to find in rest of
the worksheets.
I am recording a macro for this.For recording I do Ctrl+F, and type in
the input number in "Find What" textbox. The other settings of the
Find box are:
Within: Workbook
Search : By Rows
Look in : Values
Mach enitre cell contents

Obviously , the first time I hit "Find Next", I stay in the same sheet
and the cell highlighted is the same as the cell in which input is
being done. Therefore, I have to hit "Find Next" again to reach the
first occurance of this number in the rest of the worksheets.
The macro generates the following snippet:

Sheets("Sheet1").Select
var_no = Range("A3").Value
    Cells.Find(What:=var_no, After:=ActiveCell, LookIn:=xlValues,
LookAt _
        :=xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext,
MatchCase:= _
        True, SearchFormat:=False).Activate
       Sheets("Sheet2").Select
      Cells.FindNext(After:=ActiveCell).Activate)

In this case,  the input number was lying in Sheet2

Now, what I want is simply, the name of the sheet (Sheet2 in this
case) where the first occurance of that number is, to be captured in
some variable (say, var_SheetName).

Please help me with the appropriate code for this.

Thanks and Regards,
Abhijat

--~--~---------~--~----~------------~-------~--~----~
Visit the blog to download Excel tutorials at 
http://www.excel-macros.blogspot.com

To post to this group, send email to excel-macros@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/excel-macros?hl=en

Visit & Join Our Orkut Community at 
http://www.orkut.com/Community.aspx?cmm=22913620

Visit the blog to download Excel tutorials at 
http://www.excel-macros.blogspot.com

To Learn VBA Macros Please visit http://www.vbamacros.blogspot.com

To see the Daily Excel Tips, Go to:
http://exceldailytip.blogspot.com
-~----------~----~----~----~------~----~------~--~---

Reply via email to