LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 852
Default Find dupes, list in MsgBox with cell.address convert ws wide code toone sheet

Trying to convert this code to sheet 1 only, one column only (col T) and list all dupes in a msgbox with cell.address.

The search item could be for a number or text.

Thanks.
Howard


Sub FindSheetsWithID()
'/ code by Garry
' Looks for an ID on all sheets except "Sheet1",
' and notifies the result of the search.
Dim ws As Worksheet, Rng As Range
Dim sID$, sIdShts$, sMsg$
Dim bFoundID As Boolean

sID = InputBox("Enter a Client ID number")
If Trim(sID) = "" Then Exit Sub

For Each ws In ThisWorkbook.Worksheets
If Not ws.Name = "Sheet1" Then
Set Rng = ws.UsedRange.Find(What:=sID, _
LookIn:=xlValues, _
LookAt:=xlWhole, _
SearchOrder:=xlByColumns)
If Not Rng Is Nothing Then
bFoundID = True

sIdShts = sIdShts & ",'" & ws.Name & "'!" & Rng.Address

End If
End If
Next ws
If bFoundID Then
sMsg = "The ID (" & sID & ") was found on the following sheets:"
sMsg = sMsg & vbLf & vbLf
sMsg = sMsg & Join(Split(Mid(sIdShts, 2), ","), vbLf)


Else
sMsg = "ID not found"
End If
MsgBox sMsg
End Sub
 
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
MsgBox cell address A & S Excel Programming 3 July 30th 09 03:13 PM
Returning a cell address in a msgbox, by selection via inputbox Ty FARAZ QURESHI Excel Discussion (Misc queries) 3 April 8th 09 12:57 PM
Convert street address to zip code SJC Excel Worksheet Functions 1 April 25th 08 08:50 PM
Find Blank Cells and List Each Cell Address in Another Sheet ryguy7272 Excel Programming 4 August 13th 07 04:24 PM


All times are GMT +1. The time now is 06:59 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"