I get "Application-Defined or Object-Defined Error" while I run the below Macro.
I want to parse through each column in "DB" sheets and search for that column.
Sub test()
Dim FindString As Range
Dim Rng As Range
Dim i, j As Integer
Dim finalcol As Long
Worksheets("DB").Select
finalcol = Worksheets("DB").Cells(1, Application.Columns.Count).End(x1toleft).column
On Error Resume Next
For i = 1 To finalcol
FindString = Cells(1, i).Value
If Trim(FindString) <> "" Then
With Sheets("DB").Range("A:A")
Set Rng = .Find(What:=FindString, _
After:=.Cells(.Cells.Count), _
LookIn:=xlValues, _
LookAt:=xlWhole, _
SearchOrder:=xlByRows, _
SearchDirection:=xlNext, _
MatchCase:=False)
If Not Rng Is Nothing Then
Application.Goto Rng, True
Else
MsgBox "Nothing found"
End If
End With
End If
Next i
On Error GoTo 0
End Sub