+ Reply to Thread
Results 1 to 4 of 4

If 3 conditions are true

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    04-23-2007
    Location
    Texas
    Posts
    417

    If 3 conditions are true

    Can someone tell me what is wrong with this code?

    Does it have something to do with 2 and statements?

    Sub cDOW_State()
    
    Dim cDOW As Range
    
    For Each cDOW In ActiveSheet.Range("H2904:H" & Cells(Rows.Count, "H").End(xlUp).Row)
     If cDOW.Value.IsNumber And cDOW.Offset(0, 3).Value = "Urgent" And _
                                cDOW.Offset(-3, -9).Value = "M" Then cDOW.Select
     Next cDOW
    
    
    End Sub
    Thank you for your help. I'm trying to learn what I can and when stuff like this happens it drives me nuts... and I can't stop staring at it....and pressing F8!
    If we all use our Minds our Heads and our Brains NO TELLING what we could come up with!!

  2. #2
    Valued Forum Contributor ranman256's Avatar
    Join Date
    07-29-2012
    Location
    Kentucky
    MS-Off Ver
    Excel 2003
    Posts
    1,178

    Re: If 3 conditions are true

    Im not sure what you want.
    Here, it goes thru each cell, if all 3 are true then it selects the cell, BUT,
    it moves to the NEXT cell,and selects it. So, at most, you will only have 1 cell selected.
    Is this what you want?

    Or do you want to select ALL cells?
    Actually it would be better to COLOR cells rather than select.
    once you select the next cell, the prior one turns off. (deselects)

  3. #3
    Forum Contributor
    Join Date
    04-23-2007
    Location
    Texas
    Posts
    417

    Re: If 3 conditions are true

    yes - I was using the select to test the code. I have other stuff I'm going to add after I figure out why it keeps giving me an error.
    "Object required"

  4. #4
    Valued Forum Contributor ranman256's Avatar
    Join Date
    07-29-2012
    Location
    Kentucky
    MS-Off Ver
    Excel 2003
    Posts
    1,178

    Re: If 3 conditions are true

    you didnt mention the "Object required" error.

+ 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] IF Two Conditions Are True Output V1 or P1
    By singlek in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 05-28-2015, 02:32 PM
  2. Change from checking if 2 conditions are true to if any of 4 conditions are true
    By tafoyavision in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 03-26-2014, 02:17 PM
  3. Replies: 1
    Last Post: 03-26-2014, 02:14 PM
  4. Count if 2 conditions are true
    By Aladin Akyurek in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 09-06-2005, 04:05 AM
  5. [SOLVED] Count if 2 conditions are true
    By Thrava in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 03:05 AM

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