ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Marco code needed to find contents of cell a1 in entire workbook (https://www.excelbanter.com/excel-programming/426499-marco-code-needed-find-contents-cell-a1-entire-workbook.html)

GMc

Marco code needed to find contents of cell a1 in entire workbook
 
Marco code needed to find contents of cell a1 in entire workbook and then go
to that cell.

Gary''s Student

Marco code needed to find contents of cell a1 in entire workbook
 
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
--
Gary''s Student - gsnu200843


"gmc" wrote:

Marco code needed to find contents of cell a1 in entire workbook and then go
to that cell.



All times are GMT +1. The time now is 12:34 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com