i need to return the row numbers of any row where the first cell (column A) contains a certain text string. i know how to look for the row number of the first instance of the text, but how do i continue looking down the column for more instances?
Cheers, Craig
Si fractum non sit, noli id reficere
Code:
Option Explicit
Function findRows()
'declare variables
Dim strSearchString 'text to search for
Dim ws1 As Worksheet 'worksheet to search
Dim ws2 As Worksheet 'destination worksheet
Dim rngSearch As Range 'range of cells to search
Dim lngRowNum As Long 'holds row number
Dim rngDest As Range 'cells to hold returned row numbers
strSearchString = "Ad-hoc Duties"
Set ws1 = Worksheets("sheet1")
Set ws2 = Worksheets("sHider")
Set rngSearch = ws1.Range("A:A")
Set rngDest = ws2.Range("h2")
lngRowNum = rngSearch.Find(strSearchString).Row
rngDest.Value = lngRowNum
End Function
Cheers, Craig
Si fractum non sit, noli id reficere