+ Reply to Thread
Results 1 to 8 of 8

Application-Defined or Object-Defined error

  1. #1
    Registered User
    Join Date
    04-27-2012
    Location
    New York, USA
    MS-Off Ver
    Excel 2010
    Posts
    63

    Application-Defined or Object-Defined error

    I am trying to adapt a loop I used in a different sub to look through my sheet and find the rows where a conditional formatting rule I made has highlighted the cells yellow and send an email out. However, I am getting an application-defined or object-defined error when I try to run it. Any suggestions on how to fix this? Thank you in advance!

    Please Login or Register  to view this content.
    I get the bug on the line "Do While Len(start_cell.Cells(i, 1).Value) > 0"

    Thank you again for any help !

  2. #2
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689

    Re: Application-Defined or Object-Defined error

    The variable i is not initialized, so it's zero, which is invalid when you're starting in row 1.
    Entia non sunt multiplicanda sine necessitate

  3. #3
    Registered User
    Join Date
    04-27-2012
    Location
    New York, USA
    MS-Off Ver
    Excel 2010
    Posts
    63

    Re: Application-Defined or Object-Defined error

    I have changed start_cell to B3 (where my data starts) but I am still getting the error. I think its because of the "If Range("B:U").FormatConditions(1).Formula1 Then" line. I am trying to find the rows that meet my conditional formatting rule, but I'm not sure how to call upon the rule. Is it possible to name conditional formatting rules?

  4. #4
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689

    Re: Application-Defined or Object-Defined error

    I have changed start_cell to B3 (where my data starts) but I am still getting the error.
    You're now getting an error on a different line of code, no?

  5. #5
    Registered User
    Join Date
    04-27-2012
    Location
    New York, USA
    MS-Off Ver
    Excel 2010
    Posts
    63

    Re: Application-Defined or Object-Defined error

    I'm sorry. Yes, now I am getting a type mismatch error on the line: "If Range("B:U").FormatConditions(1).Formula1 Then"

  6. #6
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689

    Re: Application-Defined or Object-Defined error

    It's very messy trying to figure out what conditional formatting is doing for the general case. I suggest you duplicate whatever logic is used in conditional formatting in code.

  7. #7
    Registered User
    Join Date
    04-27-2012
    Location
    New York, USA
    MS-Off Ver
    Excel 2010
    Posts
    63

    Re: Application-Defined or Object-Defined error

    I am working on that now. Thanks for the advise! I will post back once (if) I get it working.

  8. #8
    Registered User
    Join Date
    04-27-2012
    Location
    New York, USA
    MS-Off Ver
    Excel 2010
    Posts
    63

    Re: Application-Defined or Object-Defined error

    This code works! Thanks for your advise.

    Please Login or Register  to view this content.

+ 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