Convert Excel IF ISERROR formula to VBA

U

u473

Found = ""
For Each cell In Rng
'The following formula works in Excel
'nFound = left(B6,if(iserror(Find(" 3.",B6)),0,Find(" 3.",B6)))
'
' However, all my syntax variations to adapt it in VBA do not work.
Can you help me
'
nFound = "=left(cell.value,if iserror(Find(' 3.',cell.value)),
0,Find(' 3.',cell.value))"
If nFound <> Found Then
'Copy Row ........
Found = nFound
End If
Next cell
'
Help appreciated.
 
D

Dave Peterson

Look at VBA's help for InStr. It's the VBA equivalent of Excel's =Find()/=Search().
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top