Results 1 to 8 of 8

Count column value then adjacent column cell fill color

Threaded View

  1. #5
    Valued Forum Contributor
    Join Date
    03-28-2014
    Location
    Kuala Lumpur, Malaysia
    MS-Off Ver
    Excel 2016
    Posts
    702

    Re: Count column value then adjacent column cell fill color

    Hi MIGARDEIN,

    Please try this,
    You may use vb constant colour to change your preferred colour
    i.e. vbYellow, vbRed, VbBlue, etc. or customize colour using RGB (255,255,255) 'white

    Sub test()
    Dim ws As Worksheet
    Dim Car As Range
    Dim CountCAR1 As Long, CountCAR2 As Long
    Dim rngColour As Variant
    
    Set ws = Sheets("Sheet1")
    Set Car = Range(ws.Cells(2, "A"), ws.Cells(Rows.Count, "A").End(xlUp))
    
        For Each rngColour In Car.Offset(, 1)
            If rngColour.Interior.Color = vbYellow And rngColour.Offset(, -1) = "CAR 1" Then
                CountCAR1 = CountCAR1 + 1
            End If
            
            If rngColour.Interior.Color = vbYellow And rngColour.Offset(, -1) = "CAR 2" Then
                CountCAR2 = CountCAR2 + 1
            End If
        Next rngColour
        
     ws.Range("E2").Value = CountCAR1
     ws.Range("E3").Value = CountCAR2
    End Sub
    If the above helped you, please add reputation to me
    Last edited by Faridwahidi; 08-04-2015 at 11:45 AM.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 1
    Last Post: 07-20-2015, 10:58 AM
  2. [SOLVED] count number of cells in Column C that have a lesser or equal value to the adjacent cell
    By Geoff Jones in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 12-18-2013, 11:01 AM
  3. Replies: 1
    Last Post: 11-05-2013, 07:58 PM
  4. [SOLVED] Count Unique Values in a Column that are not in adjacent Column
    By sskgintl in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 10-15-2013, 03:18 PM
  5. Replies: 4
    Last Post: 10-21-2010, 11:05 AM
  6. Replies: 0
    Last Post: 03-09-2005, 06:47 AM
  7. Using COUNTIF to count column entries if adjacent column contains data
    By johnfullerroot in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 03-09-2005, 05:43 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