Professional Documents
Culture Documents
Search Data
Search Data
Search Data
Sub SearchData()
Dim strSearch As String
Dim strPath As String
Dim strFile As String
Dim wksReport As Worksheet
Dim wbk As Workbook
Dim wks As Worksheet
Dim startRow As Long
Dim rngFound As Range
Dim strFirstAddress As String
Application.ScreenUpdating = False
With wksReport
.Cells(startRow, 1) = "WORKBOOK"
.Cells(startRow, 2) = "WORKSHEET"
.Cells(startRow, 3) = "CELL ADDRESS"
.Cells(startRow, 4) = "TEXT FOUND"
Do
If rngFound is Nothing Then
Exit Do
Else
startRow = startRow + 1
.Cells(startRow, 1) = wbk.Name
.Cells(startRow, 2) = wks.Name
.Cells(startRow, 3) = rngFound.Address
.Cells(startRow, 4) = rngFound.Value
End If
Next
wbk.Close (False)
strFile = Dir
Loop
.Columns("A:D").EntireColumn.AutoFit
End With
If wksReport.Cells(2,1) = "" Then
MsgBox "All workbooks in folder has been searched!!!", vbCrLf & "No
Data Found...!!!"
Cells(startRow, 1) = ""
Cells(startRow, 2) = ""
Cells(startRow, 3) = ""
Cells(startRow, 4) = ""
Application.DisplayAlerts = False
wksReport.Delete
Else
End If
Application.ScreenUpdating = True
Application.DisplayAlerts = True
End Sub