+ Reply to Thread
Results 1 to 6 of 6

Why is my Simple Recorded Macro not working?

  1. #1
    Registered User
    Join Date
    07-30-2013
    Location
    Cardiff, Wales
    MS-Off Ver
    Excel 2000
    Posts
    23

    Why is my Simple Recorded Macro not working?

    Hi everyone,

    I have recorded a macro to input a formula and drag down to get results for a whole table. Really simple.

    This is what I wrote:

    Please Login or Register  to view this content.
    When I run this macro, why does nothing occur on the screen? viz a viz, no formulas appear where they are intended to be.

    See attached workbook: To see what I'm on about, on open sheet, run macro "NotWorking"

    Any help would be greatly appreciated!

    Andrew
    Attached Files Attached Files
    Last edited by andrew93hughes; 08-27-2013 at 06:54 AM. Reason: grammar

  2. #2
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Why is my Simple Recorded Macro not working?

    As you have active cell in your code, your cursor has to be on active cell when you run the code

  3. #3
    Registered User
    Join Date
    07-30-2013
    Location
    Cardiff, Wales
    MS-Off Ver
    Excel 2000
    Posts
    23

    Re: Why is my Simple Recorded Macro not working?

    So do I just remove the active cell line?

  4. #4
    Forum Expert Solus Rankin's Avatar
    Join Date
    05-24-2013
    Location
    Hollywood, CA
    MS-Off Ver
    Win7 Office 2010 VS Express 2012
    Posts
    2,655

    Re: Why is my Simple Recorded Macro not working?

    Please Login or Register  to view this content.
    Just put in the Range you'd like to fill down from. Above I just assumed it was Range("F1")
    Thanks,
    Solus


    Please remember the following:

    1. Use [code] code tags [/code]. It keeps posts clean, easy-to-read, and maintains VBA formatting.
    Highlight the code in your post and press the # button in the toolbar.
    2. Show appreciation to those who have helped you by clicking below their posts.
    3. If you are happy with a solution to your problem, mark the thread as [SOLVED] using the tools at the top.

    "Slow is smooth, smooth is fast."

  5. #5
    Valued Forum Contributor
    Join Date
    07-17-2005
    Location
    Abergavenny, Wales, UK
    MS-Off Ver
    XL2003, XL2007, XL2010, XL2013, XL2016
    Posts
    608

    Re: Why is my Simple Recorded Macro not working?

    Hi Andrew

    You have errors with your formula as well.
    You are indexing J4:47, whereas it should be J3:J46 and you are testing for hte 13 left characters of A4 in the first instance instead of A5

    You formula should be
    =IF(ISERROR(INDEX($L$3:$L$46,MATCH(LEFT(A5,13),$J$3:$J$46,0))),"",INDEX($L$3:$L$46,MATCH(LEFT(A5,13),$J$3:$J$46,0)))

    or in R1C! notation
    "=IF(ISERROR(INDEX(R3C12:R46C12,MATCH(LEFT(RC[-5],13),R3C10:R46C10,0))),"""",INDEX(R3C12:R46C12,MATCH(LEFT(RC[-5],13),R3C10:R46C10,0)))"

    The code to achieve what you want would be better written as

    Please Login or Register  to view this content.
    The formula itself would be far more efficient if you used Countif to test for the presence of your code, rather than using ISERROR and 2 MATCH, INDEX functions

    =IF(COUNTIF(R[-2]C[4]:R[41]C[4],LEFT(RC[-5],13)),INDEX(R3C12:R46C12,MATCH(LEFT(RC[-5],13),R3C10:R46C10,0)),"""")
    --
    Regards
    Roger Govier
    Microsoft Excel MVP

  6. #6
    Registered User
    Join Date
    07-30-2013
    Location
    Cardiff, Wales
    MS-Off Ver
    Excel 2000
    Posts
    23

    Re: Why is my Simple Recorded Macro not working?

    Thanks Roger, sorted me right out!

    Cheers,

    Andrew

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Making Simple Recorded Macro Generally Applicable
    By One-Eyed Enos in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-06-2012, 11:16 AM
  2. Recorded Macro not Working Properly
    By ilias in forum Excel General
    Replies: 1
    Last Post: 07-15-2010, 09:47 AM
  3. Error in a simple recorded Macro
    By modytrane in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 07-10-2008, 11:23 AM
  4. VB code request for a Working Recorded Macro
    By hsmeet in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 08-30-2007, 11:40 AM
  5. Simple recorded macro crashes on playback. Why?
    By Paul in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-09-2005, 04:10 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1