Forum Discussion
Rudrabhadra
Oct 23, 2023Brass Contributor
Find the column and row number in an excel spread sheet based on criteria.
Hi Good day, I am looking for a way to find the address of a cell based on a criteria. I am having specific data placed randomly in sheet 1 of a workbook in different columns and rows. (like Apple,...
OliverScheurich
Oct 23, 2023Gold Contributor
Sub findstring()
Dim cell, bereich As Range
Dim i As Long
Set bereich = Sheets("sheet1").Range("A1:H100")
For Each cell In bereich
For i = 1 To 3
If cell.Value = Cells(i, 12).Value Then
Cells(i, 13).Value = cell.Address
Else
End If
Next i
Next cell
End Sub
This code returns the position of a search string within the range A1:H100 in sheet1. A search string can be entered in cell L1, L2 and L3 of sheet2 and the address of the search string is returned in cell M1, M2 and M3. The code performs an exact match.