How to copy results from Find and Replace dialog box

I need the list of all the items found. How can I copy the values displayed in the dialog box of the find and replace?
Answer
Answer

Hi,

 

Try this macro. ALT+F11 to open VB editor, right click 'ThisWorkbook' and insert module and paste the code below in and run it.

 

The code currently outputs the addresses and value to columns Z & AA. Change column Z where indicated in the code for a convenient column for you.

 

 

 

 

Sub Find_All()
Dim FindRange As Range, c As Range
Dim OutColumn As String, x As Long
'Column Where we put the data, change to suit
OutColumn = "Z"
x = 1
For Each c In ActiveSheet.UsedRange
If c.Interior.Color = RGB(220, 230, 241) And c.Font.Color = RGB(255, 0, 0) Then
         If FindRange Is Nothing Then
                 Set FindRange = c
         Else
                 Set FindRange = Union(FindRange, c)
         End If
End If
Next

If Not FindRange Is Nothing Then
     For Each c In FindRange
      Cells(x, OutColumn) = c.Address
      Cells(x, OutColumn).Offset(, 1) = c.Value
      x = x + 1
    Next
End If

 End Sub

If this response answers your question then please mark as answer.

Mike H

1 person found this reply helpful

·

Was this reply helpful?

Sorry this didn't help.

Great! Thanks for your feedback.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this reply?

Thanks for your feedback.

 
 

Question Info


Last updated May 7, 2024 Views 12,631 Applies to: