Dialog Box, Searching for keywords in an Excel Workbook

Good morning, afternoon, evening...

I need to create a little macro in an Excel workbook, that woud allow the user to type a keyword or a phrase, and check if this phrase or keyword exists within the same workbook or another (I guess I would just need to change the path of the work book).

The rule is the following:

- If the text entered is in one of the cells of Column A of each worksheet, the returned result will be the content of each cell of the Column B

- If the search does not return any result, the text entered will be displayed with an error message

A big thanks in advance for those who can help me doing this.

Alexandre



Answer this question

Dialog Box, Searching for keywords in an Excel Workbook

  • Ralo

    here's some additonal info from the support engineer, but Derek might have already covered the same ground.

    Here is the code to go through all the work sheet to search a key word.

    ===

    Cells.Find(What:="s", After:=ActiveCell, LookIn:=xlFormulas, LookAt:= _

    xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=False _

    , SearchFormat:=False).Activate

    Sheets("Sheet1").Select

    Cells.FindNext(After:=ActiveCell).Activate

    Sheets("Sheet2").Select

    Cells.FindNext(After:=ActiveCell).Activate

    Sheets("Sheet3").Select

    Cells.FindNext(After:=ActiveCell).Activate

    Sheets("Sheet1").Select

    Cells.FindNext(After:=ActiveCell).Activate

    Sheets("Sheet2").Select

    Cells.FindNext(After:=ActiveCell).Activate

    Sheets("Sheet3").Select

    Cells.FindNext(After:=ActiveCell).Activate

    ===

    -brenda (ISV Buddy Team)



  • sangminny

    If your trying to create the macro in Excel then you will be using VBA which is a very different version of VB than VB.Net

     

    These forums are intended for VB.NEt questions and not really for other products which may have older versions of VB or VB in there name.   VBA is one of these.  VBA – this mostly deals with the legacy story for office automation.  VBA is based upon older VB6 era technology So often the best place to find answers is.

     

    Office Automation: office.developer.automation newsgroup

    http://msdn.microsoft.com/newsgroups/default.aspx dg=microsoft.public.office.developer.automation&lang=en&cr=US

     


    http://forums.microsoft.com/MSDN/ShowForum.aspx ForumID=74&SiteID=1

     

    If you wants to build a VB.NET based solution in (Outlook, Sharepoint, Infopath, Word, or Excel), then we’d point to VSTO (Trinity) forums:  http://forums.microsoft.com/MSDN/default.aspx forumgroupid=4&siteid=1

     

     I hope that helps and points you in the direction where you more likely to get some positive response.

     

     


  • UltimateKylie

    Hello,

    Here's some code that demonstrates a search on column A for a range (cell) containing a date.

    'find start row containing start date in process sheet
    Dim rngStartProcess As Range
    wrkProcessSheet.Select
    wrkProcessSheet.Columns("A:A").Select
    With Application.Selection
    Set rngStartProcess = .Find(Me.txtStartDate.Text, LookIn:=xlValues)
    End With

    If the item isn't found then rngStartProcess is Nothing, if it is found then it contains the rnage (cell) that has that value. You've got access to address, row and column properties from the returned range.



  • Dialog Box, Searching for keywords in an Excel Workbook