Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 46
Default recording macro for a formula

I've created the following formula on a worksheet that works properly but
when I try to record a macro to create the formula in visual basic editor it
doesn't would. I get an error "unable to record". Can anyone help me with
this?

=IF(ISERROR(IF(ISERROR(VLOOKUP(TRIM(A2),Sheet3!A:D ,4,FALSE)),VLOOKUP(TRIM(A2),Sheet1!A:C,3,FALSE),(V LOOKUP(TRIM(A2),Sheet3!A:D,4,FALSE)))),"WE
DON'T HAVE A START DATE IN OUR
SYSTEMS",IF(ISERROR(VLOOKUP(TRIM(A2),Sheet3!A:D,4, FALSE)),VLOOKUP(TRIM(A2),Sheet1!A:C,3,FALSE),VLOOK UP(TRIM(A2),Sheet3!A:D,4,FALSE)))
--
Regards,

timmulla
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 360
Default recording macro for a formula

Possibly too many characters in a cell (310)... formulas are strings
in vba.

Let me make sure I understand - you want to look for a value
corresponding to the value in a2 in column c on sheet 1 or column d on
sheet 3 and if it's not found enter text?

Cliff Edwards



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 360
Default recording macro for a formula

Here's a workaround:
(check line wrapping)
ActiveCell.Formula = _
"=IF(ISNA(IF(ISNA(VLOOKUP(B1,Sheet1!A:C,3,FALS E))" & _
",VLOOKUP(B1,Sheet3!A:D,4,FALSE),(VLOOKUP(B1,Sheet 1" & _
"!A:C,3,FALSE)))),""text"",(IF(ISNA(VLOOKUP(B1,She et1!" & _
"A:C,3,FALSE)),VLOOKUP(B1,Sheet3!A:D,4,FALSE), " & _
"(VLOOKUP(B1,Sheet1!A:C,3,FALSE)))))"

I recorded entering the text in a cell then added the "=" in the vb
editor: note "ActiveCell.Formula =", not "ActiveCell.FormulaR1C1 =".
Edit the references and text to your needs.

Not really sure the mechanics behind this issue - anyone else?


Cliff Edwards

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 46
Default recording macro for a formula

Got it to work thanks
--
Regards,

timmulla


"ward376" wrote:

Here's a workaround:
(check line wrapping)
ActiveCell.Formula = _
"=IF(ISNA(IF(ISNA(VLOOKUP(B1,Sheet1!A:C,3,FALS E))" & _
",VLOOKUP(B1,Sheet3!A:D,4,FALSE),(VLOOKUP(B1,Sheet 1" & _
"!A:C,3,FALSE)))),""text"",(IF(ISNA(VLOOKUP(B1,She et1!" & _
"A:C,3,FALSE)),VLOOKUP(B1,Sheet3!A:D,4,FALSE), " & _
"(VLOOKUP(B1,Sheet1!A:C,3,FALSE)))))"

I recorded entering the text in a cell then added the "=" in the vb
editor: note "ActiveCell.Formula =", not "ActiveCell.FormulaR1C1 =".
Edit the references and text to your needs.

Not really sure the mechanics behind this issue - anyone else?


Cliff Edwards


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
Recording a Macro Sharon Excel Discussion (Misc queries) 5 March 22nd 07 01:40 PM
My excel macro recorder no longer shows up when recording macro jack Excel Discussion (Misc queries) 1 February 5th 07 09:31 PM
My excel macro recorder no longer shows up when recording macro jack Excel Discussion (Misc queries) 3 February 5th 07 08:22 PM
How do I make the Stop Recording bar pop up when recording macros J Excel Worksheet Functions 1 January 10th 06 08:46 PM
recording macro to paste a copied ws formula Peter[_21_] Excel Programming 2 December 11th 04 09:36 PM


All times are GMT +1. The time now is 05:37 PM.

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"