Automate a FIND and GOTO the result button VBA code

phattchef

New Member
Joined
Jun 23, 2023
Messages
3
Office Version
  1. 365
Platform
  1. Windows
Hi all,
I need to find a text value in a Table (Tbl_PRICE_LIST) and then GOTO that cell.
I can do it munually bu using FIND & SELECT, but the Value I type in MUST be exact, soo
I have created a searchable drop down list in D2 and I want to create a button that copies the text value in D2 to the FIND & SELECT dialoge box and FIND NEXT in the table and GOTO to the cell.
The values are unique. There will be up to 2000 rows in the table. The values are typically only in one column (PRODUCTS)
I have tried to recor a macro but it will not open the FIND & SELECT dialoge window.
Please can some good soul point me in the right direction.
I am fairly familiar with VBA (teaching myself with an on-line course)
Kind Regards
 

Attachments

  • MANUAL SEARCH PROCEDURE.jpg
    MANUAL SEARCH PROCEDURE.jpg
    107.2 KB · Views: 16

Excel Facts

How to find 2nd largest value in a column?
MAX finds the largest value. =LARGE(A:A,2) will find the second largest. =SMALL(A:A,3) will find the third smallest
Hello again,
I have found a multitude of answers, but sadly not one that
a) COPIES the variable from a cell (D2)​
b) After finding the EXACT MATCH it must GOTO the cell in which the answer is​
HELP
 
Upvote 0
Do you just mean something like this ?

VBA Code:
Sub FindProduct()

    Dim rngProd As Range
    Dim tbl As ListObject, tblCol As ListColumn
    Dim rngGoTo As Range
    
    Set tbl = Range("Tbl_PRICE_LIST").ListObject
    Set tblCol = tbl.ListColumns("PRODUCTS")
    
    With tblCol.Range
        Set rngGoTo = .Find(What:=Range("D2").Value, LookIn:=xlValues, LookAt:=xlWhole) '
    End With
    
    If Not rngGoTo Is Nothing Then
        rngGoTo.Select
    Else
        MsgBox "The product was not found"
    End If
    
End Sub
 
Upvote 0
Solution
Hi Alex
THANK YOU for your solution...so simple when I saw it...I was just trying to overcomplicate it with loops and find nexts and find exacts
GREAT STUFF appreciate!!
kind regards
Simon Kerr
 
Upvote 0

Forum statistics

Threads
1,223,794
Messages
6,174,643
Members
452,575
Latest member
Fstick546

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