Results 1 to 6 of 6

Thread: [RESOLVED] color change the entire rows

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Jun 2007
    Posts
    241

    Resolved [RESOLVED] color change the entire rows

    I am trying to do from outlook to excel if the cell value is empty change the entire row will be yellow but i have error Cells(c.Row, 7).Value = ""
    Code:
    With Sheets("Sheet1").Range("C6:C29")
              Set c = .Find(MYName, LookIn:=xlValues)
              
              If Not c Is Nothing Then
                MyTime = olMail.ReceivedTime
             
                      Cells(c.Row, 7).Value = MyTime          
                    Else
                      Cells(c.Row, 7).Value  = ""
             Range(Cells(c.Row, 1), Cells(c.Row, 7)).Interior.ColorIndex = 35
                            End If
            End With
    Last edited by Hack; Jul 12th, 2010 at 10:54 AM. Reason: Fixed Code Tags

  2. #2
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: color change the entire rows

    What is the error?

  3. #3
    Discovering Life Siddharth Rout's Avatar
    Join Date
    Feb 2005
    Location
    Mumbai, India
    Posts
    12,001

    Re: color change the entire rows

    You will get an error if there is no text found because you will not get a value for c.Row in the "Else" part.
    A good exercise for the Heart is to bend down and help another up...
    Please Mark your Thread "Resolved", if the query is solved


    MyGear:
    ★ CPU ★ Ryzen 5 5800X
    ★ GPU ★ NVIDIA GeForce RTX 3080 TI Founder Edition
    ★ RAM ★ G. Skill Trident Z RGB 32GB 3600MHz
    ★ MB ★ ASUS TUF GAMING X570 (WI-FI) ATX Gaming
    ★ Storage ★ SSD SB-ROCKET-1TB + SEAGATE 2TB Barracuda IHD
    ★ Cooling ★ NOCTUA NH-D15 CHROMAX BLACK 140mm + 10 of Noctua NF-F12 PWM
    ★ PSU ★ ANTEC HCG-1000-EXTREME 1000 Watt 80 Plus Gold Fully Modular PSU
    ★ Case ★ LIAN LI PC-O11 DYNAMIC XL ROG (BLACK) (G99.O11DXL-X)
    ★ Monitor ★ LG Ultragear 27" 240Hz Gaming Monitor
    ★ Keyboard ★ TVS Electronics Gold Keyboard
    ★ Mouse ★ Logitech G502 Hero

  4. #4

    Thread Starter
    Addicted Member
    Join Date
    Jun 2007
    Posts
    241

    Re: color change the entire rows

    could you help me Kool
    so how do i put it in the code if the cell value is empty the entrie row will be changed the yellow color

  5. #5
    Discovering Life Siddharth Rout's Avatar
    Join Date
    Feb 2005
    Location
    Mumbai, India
    Posts
    12,001

    Re: color change the entire rows

    Quote Originally Posted by kamakshi View Post
    could you help me Kool
    so how do i put it in the code if the cell value is empty the entrie row will be changed the yellow color
    Sure

    Is this what you are trying?

    Code:
        With Sheets("Sheet1").Range("C6:C29")
            Set c = .Find(MYName, LookIn:=xlValues)
            If Not c Is Nothing Then
                MyTime = olMail.ReceivedTime
                Cells(c.Row, 7).Value = MyTime
            Else
                Range("C6:C29").Value = ""
                Range("C6:C29").Interior.ColorIndex = 6 '<~~ Yellow Color
            End If
        End With
    A good exercise for the Heart is to bend down and help another up...
    Please Mark your Thread "Resolved", if the query is solved


    MyGear:
    ★ CPU ★ Ryzen 5 5800X
    ★ GPU ★ NVIDIA GeForce RTX 3080 TI Founder Edition
    ★ RAM ★ G. Skill Trident Z RGB 32GB 3600MHz
    ★ MB ★ ASUS TUF GAMING X570 (WI-FI) ATX Gaming
    ★ Storage ★ SSD SB-ROCKET-1TB + SEAGATE 2TB Barracuda IHD
    ★ Cooling ★ NOCTUA NH-D15 CHROMAX BLACK 140mm + 10 of Noctua NF-F12 PWM
    ★ PSU ★ ANTEC HCG-1000-EXTREME 1000 Watt 80 Plus Gold Fully Modular PSU
    ★ Case ★ LIAN LI PC-O11 DYNAMIC XL ROG (BLACK) (G99.O11DXL-X)
    ★ Monitor ★ LG Ultragear 27" 240Hz Gaming Monitor
    ★ Keyboard ★ TVS Electronics Gold Keyboard
    ★ Mouse ★ Logitech G502 Hero

  6. #6

    Thread Starter
    Addicted Member
    Join Date
    Jun 2007
    Posts
    241

    Re: [RESOLVED] color change the entire rows

    Thanks Kool

Posting Permissions

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



Click Here to Expand Forum to Full Width