Ark68
Well-known Member
- Joined
- Mar 23, 2004
- Messages
- 4,632
- Office Version
- 365
- 2016
- Platform
- Windows
What would be a likely cause of an "Expected Sub, Function, or Property" error with the highlighted line in the code snippet below. Anyone able to help me with a solution?
And then I have this function ...
Rich (BB code):
...
Do While .Cells(tcr, 27) <> ""
ttle = .Range("C" & i)
tmdl = .Range("AA" & tcr)
fndrow ttle, tmdl
MsgBox tmdl & " found at row: " & fndrow, , ttle
Loop
...
And then I have this function ...
VBA Code:
Function fndrow(ttle As String, tmdl As String) As Long
Dim rng As Range
Dim rowNumber As Long
Dim found As Boolean
' Define the range to search
Set rng = ws_ifm.Range("A3:A" & ws_ifm.Cells(ws.Rows.count, "C").End(xlUp).Row)
' Initialize variables
found = False
' Loop through each cell in column C
For Each cell In rng
' Check if Column C equals Value1 and Column F equals Value2 in the same row
If cell.Value = tmdl And ws_ifm.Cells(cell.Row, "C").Value = ttle Then
rowNumber = cell.Row
found = True
Exit For ' Exit loop once a match is found
End If
Next cell
End Function