Find Text Based On Active Cell Contents

  • Hi Forum

    I have a workbook with 2 worksheets, A and B. Sheet A contains source data and sheet B a pivot table of this data. I want my user to click on a cell within the pivot table,click a button that runs a macro to find the instance of this value within Sheet A.

    I did record a macro but it did not work.
    many thanks

  • Re: Find Text Based On Active Cell Contents


    I am not an expert, but here is my solution:


    'assign macro button to "Find_Selected" & change the range values and sheet name to suit,
    'foundcell returns cell address where value is found on sheet2

  • Re: Find Text Based On Active Cell Contents

    You have to put a commandbutton. Then right click->view code on the created button, and then you will see the code windows, and some code that says:

    1. Private Sub CommandButton1_Click()
    2. End Sub

    You only have to put in this Sub whatever you want to do. For example

  • The last set of code posted does not seem to work when you have a pivot table with duplicate values. The sourceData just selected the first value. It does not look across the pivot tables row and columns to select the value that correspond to those dimensions. Does anyone have code that takes that into account?

  • MB, welcome to Ozgrid.

    Please take a few minutes to read the Forum Rules. One of them asks you not to post in another person's Thread, please start your own and add a link to this one if you think it ill help.

  • royUK

    Closed the thread.