Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>The following will search for whatever number is in the cell you have selected. In addition to finding the first result, it will ask if you want to continue searching for the next result. That way, if you have multiple instances of an issue, you can "loop" through all of the results that are found in the worksheet. It will also ignore search results found on your MainWorksheet containing your top 20 issues. Cells.Find by itself will simply return the first result found, even if it is in the same worksheet.</p> <p>It will also tell you whether or not the issue number was found in each sheet, and when all of the worksheets have been checked (in case no more results are found). If you respond that you don't want to continue searching, it will go to the first instance of the issue number that was found in the most recent worksheet that was checked.</p> <p>In order to simulate a hyperlink, you need to use a worksheet event such as Intersect (described in Sean's answer) or FollowHyperlink. Personally, I prefer to use alternatives to worksheet events where possible, as they will always trigger when the condition is met, even if unintentionally. For example, you could create a shape or macro button and assign the macro to it. That way, the code will only run when the user clicks on the button.</p> <p>Also, please let us know if there is more that you really want to do once you've identified the issue. For example, you could automatically make changes to related cells, or create a list of all of the instances of that issue (or all issues) that were found.</p> <p>Good luck!</p> <pre><code>'Create a string variable to store the problem status Dim StringProblemStatus As String 'Create a string variable to store the worksheet name of the main page containing the problem status Dim StringMainWorksheet 'Create a range variable to store the results of the Find method Dim RangeFindResults As Range 'Create an integer variable to store the current worksheet number Dim IntegerSheetCount As Integer 'Set the variable to the problem status stored in the current cell StringProblemStatus = Selection.Value 'Set the variable to the worksheet name containing the problem status StringMainWorksheet = ActiveSheet.Name 'Create a For/Next loop so that the following code will evaluate all worksheets in the workbook For IntegerSheetCount = 1 To ActiveWorkbook.Sheets.Count Sheets(IntegerSheetCount).Activate 'Search for the problem number within the worksheet 'Check that the sheet being searched is not the MainWorksheet If ActiveSheet.Name &lt;&gt; StringMainWorksheet Then 'Searches for exact matches Set RangeFindResults = _ Cells.Find( _ What:=StringProblemStatus, _ After:=ActiveCell, _ LookIn:=xlFormulas, _ LookAt:=xlWhole, _ SearchOrder:=xlByRows, _ SearchDirection:=xlNext, _ MatchCase:=False, _ SearchFormat:=False _ ) 'Returns a message to the user if the status is not found If RangeFindResults Is Nothing Then MsgBox "Problem Status " &amp; StringProblemStatus &amp; " was not found in worksheet " &amp; Sheets(IntegerSheetCount).Name Else 'Returns a message to the user if the status is found If MsgBox("Problem Status " &amp; RangeFindResults &amp; " found in worksheet " &amp; _ Sheets(IntegerSheetCount).Name &amp; " in cell " &amp; " " &amp; RangeFindResults.Address &amp; _ ". Continue searching?", vbYesNo) = vbNo Then RangeFindResults.Activate Exit Sub End If End If End If 'Move to the next worksheet Next IntegerSheetCount 'Notify the user that all worksheets have been searched MsgBox "All worksheets searched" End Sub </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload