Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #2  
Old 07-22-2023, 07:31 PM
Logit Logit is offline Windows 10 Office 2007
Expert
 
Join Date: Jan 2017
Posts: 591
Logit is a jewel in the roughLogit is a jewel in the roughLogit is a jewel in the roughLogit is a jewel in the rough
Default

Attached are three examples that can be molded to your needs.

Code:
Option Explicit

Sub FindInLists()
     '
     '
     '
     
    Dim SheetsToSearch, SrchStrg As String, ws As Excel.Worksheet, r As Range
     Set ws = Sheets("Sheet1")
    SrchStrg = Application.InputBox("Enter Term to search ", "Search Term", Type:=2)
    
    With ws
        
            With ws.Range("A2:AB5000")  'EDIT RANGE AS REQUIRED
                Set r = .Find(what:=SrchStrg, After:=.Range("A1"))   'find the cell whose value is equal to SrchStrg and activate it
                If Not r Is Nothing Then
                    ws.Activate: r.Activate
                    ws.Range("B1").Value = SrchStrg
                    ws.Range("D1").Value = ActiveCell.Address
                                       
                ElseIf r Is Nothing Then
                    MsgBox "Search term does not exist. ", vbInformation, "Item Not Found"
                End If
            End With
        
    End With
     
End Sub
Reply With Quote
 

Tags
evaluate, relative defined names

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
referencing relative cell trevorc Excel Programming 2 08-12-2019 11:56 AM
Relative link (same folder) from Excel cell into Word file SparFuX Word 1 12-18-2018 03:22 PM
One Cell that controlls spread sheet result button to change simple fomula result RAH Excel Programming 5 03-31-2018 04:52 PM
Sumif to find a single word in a cell without using wildcard kiteman Excel 3 08-23-2017 10:14 AM
Worksheet defined cell sums flextera Excel 3 06-17-2014 11:12 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 07:57 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft