+ Reply to Thread
Results 1 to 5 of 5

Excel produces Error when the code works

  1. #1
    Registered User
    Join Date
    06-19-2012
    Location
    Dallas, Texas
    MS-Off Ver
    Excel 2010
    Posts
    40

    Excel produces Error when the code works

    This code does exactly what I want it to do, but I get a run-time error every time. I'm tempted to turn off the messages, but I'm sure I'm getting this for a reason. I feel like this has something to do with me storing the cell's address as a string (myC), then referring to that as a Range later. Is there a simpler way to do this?

    This macro is called from a worksheet.change:

    Macro:
    Please Login or Register  to view this content.
    And here is the work on the sheet level

    Please Login or Register  to view this content.

  2. #2
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,653

    Re: Excel produces Error when the code works

    Can you verbalize what you want to do and the nature of your data. There may be a better way to do this.

    Is the named range "CopiedRow" on the same sheet as the myC ActiveCell?

  3. #3
    Registered User
    Join Date
    06-19-2012
    Location
    Dallas, Texas
    MS-Off Ver
    Excel 2010
    Posts
    40

    Re: Excel produces Error when the code works

    CopiedRow is on the same sheet as myC.

    So, basically, if the user changes any of the cells in the range F26:F35 to "Yes," then, I want the macro to add another row that is already formatted. I use "CopiedRow" as the original set of cells because that will always be the same. If anything from the list (it's on data validation for Yes, No, or N/A) other than Yes is selected, nothing should happen.

    When the debugger pops up, it always highlights the offset row.

  4. #4
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,653

    Re: Excel produces Error when the code works

    Quote Originally Posted by WadeLair View Post
    CopiedRow is on the same sheet as myC.

    So, basically, if the user changes any of the cells in the range F26:F35 to "Yes," then, I want the macro to add another row that is already formatted. I use "CopiedRow" as the original set of cells because that will always be the same. If anything from the list (it's on data validation for Yes, No, or N/A) other than Yes is selected, nothing should happen.

    When the debugger pops up, it always highlights the offset row.
    Try this...

    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    06-19-2012
    Location
    Dallas, Texas
    MS-Off Ver
    Excel 2010
    Posts
    40

    Re: Excel produces Error when the code works

    Thanks for your help...SOLVED!

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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