Hi
I try to matching C2 for sheet1 with value is existed across sheets, then should populate list of tabs names in column D into sheet1 if value is matched with C2 for sheet1. actually I use usedrange propertise because the value will be different in location across sheets, not in the same column.
here is the code
Sub n()
Dim sh As Worksheet, ws As Worksheet
Dim rng As Variant, rngCell As Range
Dim lngLstRow As Long, lngLstCol As Long
Set sh = Sheets("sheet1")
rng = sh.Range("C2").Value
For Each ws In Worksheets
lngLstRow = ws.UsedRange.Rows.Count
lngLstCol = ws.UsedRange.Columns.Count
For Each rngCell In Range(Cells(2, 1), Cells(lngLstRow, lngLstCol))
If rng.Value = rngCell.Value Then rng.Offset(, 1) = ws.Name
Next
Next
End Sub
it shwos error object required in this line
If rng.Value = rngCell.Value Then rng.Offset(, 1) = ws.Name