If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 Convert Excel IF ISERROR formula to VBA
 Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

## Convert Excel IF ISERROR formula to VBA

#1
November 25th 10, 01:37 AM posted to microsoft.public.excel.programming
 u473 external usenet poster Posts: 184
Convert Excel IF ISERROR formula to VBA

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.
#2
November 25th 10, 01:06 PM posted to microsoft.public.excel.programming
 Dave Peterson[_2_] external usenet poster Posts: 420
Convert Excel IF ISERROR formula to VBA

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

On 11/24/2010 19:37, u473 wrote:
> 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.

--
Dave Peterson

 Thread Tools Display Modes Linear Mode

 Posting Rules You may not post new threads You may not post replies You may not post attachments You may not edit your posts vB code is On Smilies are On [IMG] code is On HTML code is Off
 Forum Jump User Control Panel Private Messages Subscriptions Who's Online Search Forums Forums Home Excel Newsgroups     Excel Discussion (Misc queries)     Setting up and Configuration of Excel     New Users to Excel     Excel Worksheet Functions     Links and Linking in Excel     Charts and Charting in Excel     Excel Programming About ExcelBanter     About this forum

 Similar Threads Thread Thread Starter Forum Replies Last Post Formula Help - Lookup, if, iserror?? Ash Excel Discussion (Misc queries) 9 November 7th 08 05:08 PM Using iserror in formula forest8 Excel Discussion (Misc queries) 1 September 2nd 07 03:51 AM Using ISERROR to Solve #DIV/0 in a formula Leigh Douglass Excel Worksheet Functions 13 August 23rd 07 06:12 PM ISERROR Formula Toyin Excel Programming 1 November 16th 04 10:44 AM IsError Formula Steph[_3_] Excel Programming 1 May 13th 04 08:21 PM

All times are GMT +1. The time now is 11:23 PM.