LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #32   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,514
Default Final version...

Final version follows for anyone interested...


Sub FindSheetsWithID_v6()
' Looks for an ID on all sheets with search tag,
' and outputs results to summary sheet named "Instructions".
' Note: The search tag is a local scope defined name range
' that contains the search data column address.

Dim Wks As Worksheet, wksTarget As Worksheet, rng As Range
Dim sOut$, sAddr1$, lCount&, n&, vData

Const sRngToSearch$ = "MyTag" '//edit to suit

Set wksTarget = ThisWorkbook.Sheets("Instructions")
'Assume comma delimited ID list stored in named range
With wksTarget
.Activate: vData = Split(.Range("IdList").Text, ",")
End With
If VarType(vData) < vbArray Then Exit Sub

On Error GoTo Cleanup
ReDim vDataOut(UBound(vData))
For n = LBound(vData) To UBound(vData)
sOut = ""
For Each Wks In ThisWorkbook.Worksheets
If bNameExists(sRngToSearch, Wks) Then
sOut = sOut & "," & Wks.Name & "=": sAddr1 = ""
With Wks.Range(sRngToSearch)
Set rng = .Find(What:=vData(n), LookIn:=xlValues, _
LookAt:=xlWhole, SearchOrder:=xlByColumns)
If Not rng Is Nothing Then
sAddr1 = rng.Address
Do
lCount = lCount + 1: Set rng = .FindNext(rng)
Loop While Not rng Is Nothing And rng.Address < sAddr1
End If 'Not rng Is Nothing
End With 'Wks.Range(sRngToSearch)
sOut = sOut & lCount: lCount = 0
End If 'bNameExists
Next 'Wks
vDataOut(n) = Split(vData(n) & "|" & Mid$(sOut, 2), "|")
Next 'n

'Output to worksheet
Xform_1DimArrayOfArraysTo2D vDataOut
With wksTarget.Cells(Rows.Count, "A").End(xlUp)(2)
.Resize(UBound(vDataOut), UBound(vDataOut, 2)) = vDataOut
.EntireColumn.NumberFormat = "@"
End With


Cleanup:
Set wksTarget = Nothing: Set rng = Nothing
End Sub

--
Garry

Free usenet access at http://www.eternal-september.org
Classic VB Users Regroup!
comp.lang.basic.visual.misc
microsoft.public.vb.general.discussion


 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Search for values in a sheet and copy found records one after theother in another sheet AndreasHermle Excel Programming 12 June 17th 11 08:12 PM
Reducing a List by Eliminating Entries in it Found in Another List Ralph Excel Programming 7 September 30th 09 05:21 PM
Excell Dropdown List. Display alternate text than found in list. Shawnn Excel Discussion (Misc queries) 14 December 11th 08 07:43 PM
I found these text strings printed out. What would they do if used in VBA? Enda Excel Programming 2 November 23rd 06 03:41 PM
How to find number of pairs of strings from list of strings? greg_overholt Excel Worksheet Functions 5 January 27th 06 10:42 PM


All times are GMT +1. The time now is 10:43 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"