Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > microsoft.public.excel.programming > #109600

Re: Fill Cell with Colour if Q

From Claus Busch <claus_busch@t-online.de>
Newsgroups microsoft.public.excel.programming
Subject Re: Fill Cell with Colour if Q
Date 2016-11-17 16:34 +0100
Organization A noiseless patient Spider
Message-ID <o0kikh$cfa$1@dont-email.me> (permalink)
References <86c817e5-f3c4-44bc-a475-449d0738ec27@googlegroups.com>

Show all headers | View raw


Hi Sean,

Am Thu, 17 Nov 2016 07:22:08 -0800 (PST) schrieb seanryanie@yahoo.co.uk:

> Is there VBA code that will fill a cell with a certain colour, say yellow, if another cell = value of any one of 5,6,100,175,101 etc
> 
> I have the array list in a Range (called 'Products) and I want to easily see these products on a Sales mix report?
> 
> So Column E contains the Product Number; Col F Contains Product Name, which I want to fill with a colour, and Col M contains Qty Sold, which I'd like also to fill with a colour


try:

Sub FillColor()
Dim LRow As Long
Dim rngC As Range

With ActiveSheet
    LRow = .Cells(.Rows.Count, "E").End(xlUp).Row
    For Each rngC In .Range("E2:E" & LRow)
        If Application.CountIf(Range("Products"), rngC) > 0 Then
            rngC.Offset(, 1).Interior.Color = vbYellow
            rngC.Offset(, 8).Interior.Color = vbYellow
        End If
    Next
End With
End Sub


Regards
Claus B.
-- 
Windows10
Office 2016

Back to microsoft.public.excel.programming | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Fill Cell with Colour if Q seanryanie@yahoo.co.uk - 2016-11-17 07:22 -0800
  Re: Fill Cell with Colour if Q Claus Busch <claus_busch@t-online.de> - 2016-11-17 16:34 +0100
    Re: Fill Cell with Colour if Q seanryanie@yahoo.co.uk - 2016-11-17 07:47 -0800
      Re: Fill Cell with Colour if Q Claus Busch <claus_busch@t-online.de> - 2016-11-17 17:26 +0100
        Re: Fill Cell with Colour if Q seanryanie@yahoo.co.uk - 2016-11-17 10:45 -0800
  Re: Fill Cell with Colour if Q bulong <bulong@gmail.com> - 2016-11-18 16:02 +0000

csiph-web