Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Macro - Insert formula


Hi guys


ActiveCell.FormulaR1C1 =
"IF(VLOOKUP(RC[2],Sup_list,1,FALSE)="#N/A","No","Yes")"

This is part of my macro, however the "#" messes up my macro.
Anyone know how to get around this...?


--
Ctech


------------------------------------------------------------------------
Ctech's Profile: http://www.excelforum.com/member.php...o&userid=27745
View this thread: http://www.excelforum.com/showthread...hreadid=540629

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 510
Default Macro - Insert formula

Hi Ctech,

Is'nt rather the quote inside the quote which creates th trouble ...
give a try to :
""#NA"" ...

HTH
Cheers
Carim

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Macro - Insert formula


It is not the # that is causing the problem but the fact that you have a
text string containg ". To overcome this you need to use multiple "

try

ActiveCell.FormulaR1C1 = "IF(VLOOKUP(RC[2],Sup_list,1,FALSE)=""" &
"#N/A" & """, """ & "No" & """,""" & "Yes" & """)"


--
mudraker
------------------------------------------------------------------------
mudraker's Profile: http://www.excelforum.com/member.php...fo&userid=2473
View this thread: http://www.excelforum.com/showthread...hreadid=540629

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Macro - Insert formula

I think you're getting messed up by the double quotes and the error:

I think you want:

ActiveCell.FormulaR1C1 _
= "=IF(iserror(VLOOKUP(RC[2],Sup_list,1,FALSE)),""No"",""Yes"")"

or since you're just checking for existence in one column:

ActiveCell.FormulaR1C1 _
= "=IF(iserror(match(RC[2],Sup_list,0)),""No"",""Yes"")"

And don't forget the equal sign to start your formula.

Ctech wrote:

Hi guys

ActiveCell.FormulaR1C1 =
"IF(VLOOKUP(RC[2],Sup_list,1,FALSE)="#N/A","No","Yes")"

This is part of my macro, however the "#" messes up my macro.
Anyone know how to get around this...?

--
Ctech

------------------------------------------------------------------------
Ctech's Profile: http://www.excelforum.com/member.php...o&userid=27745
View this thread: http://www.excelforum.com/showthread...hreadid=540629


--

Dave Peterson
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How do you insert a macro into a formula? Obe Excel Discussion (Misc queries) 7 November 13th 06 01:15 PM
Insert a Formula with a Macro Ed Excel Discussion (Misc queries) 2 October 22nd 06 11:37 PM
Macro to insert formula nobbyknownowt Excel Worksheet Functions 3 June 28th 06 05:16 PM
macro to insert into a formula Todd Excel Worksheet Functions 1 March 8th 06 04:55 PM
Insert macro into formula Paul Excel Worksheet Functions 1 May 12th 05 08:25 PM


All times are GMT +1. The time now is 05:13 AM.

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

About Us

"It's about Microsoft Excel"