Marco code needed to find contents of cell a1 in entire workbook

  • Thread starter Thread starter gmc
  • Start date Start date
G

gmc

Marco code needed to find contents of cell a1 in entire workbook and then go
to that cell.
 
Sub findit()
Dim s1 As Worksheet, s As Worksheet
Dim r As Range, v As Variant
Set s1 = ActiveSheet
n = s1.Name
v = Range("A1").Value
For Each s In Worksheets
s.Activate
nn = s.Name
For Each r In ActiveSheet.UsedRange
If nn = n And r.Address = "$A$1" Then
Else
If r.Value = v Then
r.Select
Exit Sub
End If
End If
Next
Next
s1.Activate
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top