A Microsoft Excel forum. ExcelBanter

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.

Go Back   Home » ExcelBanter forum » Excel Newsgroups » Excel Programming
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Convert Excel IF ISERROR formula to VBA



 
 
Thread Tools Display Modes
  #1  
Old November 25th 10, 01:37 AM posted to microsoft.public.excel.programming
u473
external usenet poster
 
Posts: 184
Default 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.
Ads
  #2  
Old November 25th 10, 01:06 PM posted to microsoft.public.excel.programming
Dave Peterson[_2_]
external usenet poster
 
Posts: 420
Default 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

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

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.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Copyright ©2004-2013 ExcelBanter.
The comments are property of their posters.