+ Reply to Thread
Results 1 to 5 of 5

Error in macro when copying formula down column

  1. #1
    Registered User
    Join Date
    06-11-2011
    Location
    Carrboro, NC
    MS-Off Ver
    Excel 2010
    Posts
    32

    Error in macro when copying formula down column

    I'm trying to add a column in my data file that will check street address data for various components of the address (e.g., "St.", "Ave.", "Blvd.") and let me know which cases have potentially incomplete data. I developed a formula that works wonderfully to search cells, and when I enter it manually and copy it down through the column manually, all goes well. When I tried to record this action to a macro, however, I keep receiving an error (Runtime error 1004: Application-defined or object-defined error.)

    Here's the code that I enter manually (that works):
    Please Login or Register  to view this content.
    And here's how the macro recorder rendered my code (which doesn't work):
    Please Login or Register  to view this content.
    From poking around in the forum, it seems my problem relates to FormulaR1C1 and potentially the references that are in the macro code. Any help would be greatly appreciated.

  2. #2
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,482

    Re: Error in macro when copying formula down column

    Was the active cell the same place as the original cell?

  3. #3
    Registered User
    Join Date
    06-11-2011
    Location
    Carrboro, NC
    MS-Off Ver
    Excel 2010
    Posts
    32

    Re: Error in macro when copying formula down column

    Oh, I left off that portion of the formula. Prior to entering the formula, I selected cell H2. The formula checks for issues in cell C2.

  4. #4
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,482

    Re: Error in macro when copying formula down column

    Try this
    Please Login or Register  to view this content.
    To split a line of code use 1 space " _" and the underscore line, don't use "&"

    Also the bottom line of your code is missing the item to search for.
    Did you use the macro recorder and type the formula?
    If you had the correct formula in H2, with H2 selected, start the macro recorder, go to the formula bar and hit enter. turn off the macro recorder.
    That is your formula in code form.
    Last edited by davesexcel; 04-26-2012 at 08:48 AM.

  5. #5
    Registered User
    Join Date
    06-11-2011
    Location
    Carrboro, NC
    MS-Off Ver
    Excel 2010
    Posts
    32

    Re: Error in macro when copying formula down column

    Thanks a lot!

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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