Gmail Calendar Documents Reader Web more »
Recently Visited Groups | Help | Sign in
Google Groups Home
Changing the background color of a cell
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  5 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Steve  
View profile  
 More options Nov 9, 9:49 pm
Newsgroups: microsoft.public.excel.programming
From: Steve <St...@discussions.microsoft.com>
Date: Mon, 9 Nov 2009 02:49:01 -0800
Local: Mon, Nov 9 2009 9:49 pm
Subject: Changing the background color of a cell
Hi

I'm comparing two lists and if a contract number equals that on another list
I want to highlight the line in the original list. I have looked for ages on
the web but everywhere that uses the range command seems to assume you know
the row but I'm trying to use two variables as below.

        If Trim(Worksheets("Cappuchino Data").Cells(iCappuchinoRow,
7).Value) = Trim(Worksheets("Subs Safety Net").Cells(iSubsSafetyRow,
3).Value) Then

            Worksheets("Cappuchino Data").Range(Cells(iCappuchinoRow, 1),
Cells(iCappuchinoRow, 31)).Interior.Color = 1
            GoTo NextCappLine

        End If

However, this just throws up an error.

Can you please help?

Many Thanks

Steve


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Jarek Kujawa  
View profile  
 More options Nov 9, 10:12 pm
Newsgroups: microsoft.public.excel.programming
From: Jarek Kujawa <bli...@gazeta.pl>
Date: Mon, 9 Nov 2009 03:12:22 -0800 (PST)
Local: Mon, Nov 9 2009 10:12 pm
Subject: Re: Changing the background color of a cell
if Excel 2003 then change

Color

to

ColorIndex

On 9 Lis, 11:49, Steve <St...@discussions.microsoft.com> wrote:


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Jacob Skaria  
View profile  
 More options Nov 9, 10:48 pm
Newsgroups: microsoft.public.excel.programming
From: Jacob Skaria <JacobSka...@discussions.microsoft.com>
Date: Mon, 9 Nov 2009 03:48:01 -0800
Local: Mon, Nov 9 2009 10:48 pm
Subject: RE: Changing the background color of a cell
Hi Steve

The below code will highlight each row if 'Cappuchino Data' column G data
match with the list in Subs Safety Net").Range("C1:C10")..Try and feedback

Sub Macro()

Dim rng1 As Range, rng2 As Range, cell As Range

Set rng1 = Worksheets("Cappuchino Data").Range("G1:G10")
Set rng2 = Worksheets("Subs Safety Net").Range("C1:C10")

For Each cell In rng1
If Trim(cell.Text) <> "" Then
If Not rng2.Find(cell.Text, , xlValues, 1) Is Nothing Then
cell.Offset(0, -6).Resize(1, 31).Interior.ColorIndex = 15
End If
End If
Next

End Sub

If this post helps click Yes
---------------
Jacob Skaria


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Steve  
View profile  
 More options Nov 10, 12:23 am
Newsgroups: microsoft.public.excel.programming
From: Steve <St...@discussions.microsoft.com>
Date: Mon, 9 Nov 2009 05:23:02 -0800
Local: Tues, Nov 10 2009 12:23 am
Subject: RE: Changing the background color of a cell
Hi

Many thanks for your response and help

Yes it does seem to have worked (i just need to confirm), however, my only
question is, I don't always know the length of each of the lists so I can't
put the range in. In this instance, I changed the values but it would be nice
to have a generic routine that will work for any lists.

I havea routine that returns the number of lines in a list so using that
would be good.

Many Thanks

Steve


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Jacob Skaria  
View profile  
 More options Nov 10, 4:46 am
Newsgroups: microsoft.public.excel.programming
From: Jacob Skaria <JacobSka...@discussions.microsoft.com>
Date: Mon, 9 Nov 2009 09:46:02 -0800
Local: Tues, Nov 10 2009 4:46 am
Subject: RE: Changing the background color of a cell
Steve

You can set that as
Set rng1 = Worksheets("Cappuchino Data").Range("G:G")
Set rng2 = Worksheets("Subs Safety Net").Range("C:C")

OR using named range

Set rng1 = Worksheets("Cappuchino Data").Range("namedrange1")
Set rng2 = Worksheets("Subs Safety Net").Range("namedrange2")

If this post helps click Yes
---------------
Jacob Skaria


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2009 Google