Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 45
Default Find cell value, set cell shading

I hope I can explain this ok!

Worksheet A is laid out as:

ID Task1 Task2 Task3 Task4
1 dd/mm/yy dd/mm/yy dd/mm/yy dd/mm/yy
2 dd/mm/yy dd/mm/yy dd/mm/yy dd/mm/yy
3 dd/mm/yy dd/mm/yy dd/mm/yy dd/mm/yy

etc

Worksheet B is laid out as:
ID Task1 Task2 Task3 Task4
1 complete on hold not started not started
2 complete complete complete not started
3 not started not started not started not started

etc

Not everything on Worksheet B can be found on Worksheet A and vice versa

What I need to do:
Is the ID on A found in B?
If yes, look along the row and where something is 'complete' on B, set the
corresponding cell on A as Blue interior, White text.
Otherwise, do nothing

In the example above, cells B2, B3, C3, and D3, would all be Blue/White. The
cell contents of A cannot be overwritten. Worksheet B is deleted once the
macro has finished running as it is just a temporary data store for doing
other background functions.

I have Chip Pearson's (thanks Chip!) fabulous modColorFunctions installed as
I've used it elsewhere in this workbook if that is of use here.

Thanks in advance for any help, all comments gratefully received.

Louise
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Find cell value, set cell shading

You don't need to use a macro to do what you asked, you can do it using
Conditional Formatting. Go to "Worksheet B" and select Cell B2, click in the
Name Box (that is the edit field on the formula bar to the left of the
formula fill-in field) and type in StartCell for its name (you can use any
name you want, but if you change it from this, you will have to change the
conditional formula below to match). Okay, now go back to "Worksheet A" and,
starting in Cell B2, select all your potential Task columns for as many row
down as you think you may ever have ID numbers entered (that is, don't be
afraid to include blank cells in the range). With that range still selected,
click on Format/Conditional Formatting on the Excel menu bar; select Formula
Is from the first drop-down and put this formula in the 2nd field...

=ISNUMBER(MATCH("Complete",OFFSET(StartCell,ROW(B2 )-2,COLUMN(B2)-2),0))

Next, click the Format button and choose White for the color of your text on
the Font tab and the Blue color you want for the interior of the cells on
the Patterns tab. Now, OK your way back to the worksheet and the appropriate
cells should be highlighted.

Rick


"Ladymuck" wrote in message
...
I hope I can explain this ok!

Worksheet A is laid out as:

ID Task1 Task2 Task3 Task4
1 dd/mm/yy dd/mm/yy dd/mm/yy dd/mm/yy
2 dd/mm/yy dd/mm/yy dd/mm/yy dd/mm/yy
3 dd/mm/yy dd/mm/yy dd/mm/yy dd/mm/yy

etc

Worksheet B is laid out as:
ID Task1 Task2 Task3 Task4
1 complete on hold not started not started
2 complete complete complete not started
3 not started not started not started not started

etc

Not everything on Worksheet B can be found on Worksheet A and vice versa

What I need to do:
Is the ID on A found in B?
If yes, look along the row and where something is 'complete' on B, set the
corresponding cell on A as Blue interior, White text.
Otherwise, do nothing

In the example above, cells B2, B3, C3, and D3, would all be Blue/White.
The
cell contents of A cannot be overwritten. Worksheet B is deleted once the
macro has finished running as it is just a temporary data store for doing
other background functions.

I have Chip Pearson's (thanks Chip!) fabulous modColorFunctions installed
as
I've used it elsewhere in this workbook if that is of use here.

Thanks in advance for any help, all comments gratefully received.

Louise


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 245
Default Find cell value, set cell shading

I have been working on somthing similar to what your doing, maybe this will
get you started.

Sub Compare()
Dim foundcell As Range
With Worksheets(2).Range("A1:A65536")

Do
On Error Resume Next
Set foundcell = .Find(What:=ActiveCell.Value, lookAt:=xlWhole,
LookIn:=xlValues, SearchOrder:=xlRows, MatchCase:=True, MatchByte:=True)

If Not foundcell Is Nothing Then
ActiveCell.Offset(0, 2).Value = "Found " & ActiveCell.Value & " in "
& "Sheet2 " & foundcell.Address
ActiveCell.Offset(0, 2).Interior.ColorIndex = 41
ActiveCell.Offset(0, 2).Font.ColorIndex = 2
ElseIf foundcell Is Nothing Then
ActiveCell.Offset(0, 2).Value = "Didn't Find " & ActiveCell.Value &
" in " & "Sheet2 "
ActiveCell.Offset(0, 2).Interior.ColorIndex = 3
ActiveCell.Offset(0, 2).Font.ColorIndex = 2
End If
ActiveCell.Offset(1, 0).Select
Loop Until ActiveCell = ""
End With
End Sub


"Ladymuck" wrote:

I hope I can explain this ok!

Worksheet A is laid out as:

ID Task1 Task2 Task3 Task4
1 dd/mm/yy dd/mm/yy dd/mm/yy dd/mm/yy
2 dd/mm/yy dd/mm/yy dd/mm/yy dd/mm/yy
3 dd/mm/yy dd/mm/yy dd/mm/yy dd/mm/yy

etc

Worksheet B is laid out as:
ID Task1 Task2 Task3 Task4
1 complete on hold not started not started
2 complete complete complete not started
3 not started not started not started not started

etc

Not everything on Worksheet B can be found on Worksheet A and vice versa

What I need to do:
Is the ID on A found in B?
If yes, look along the row and where something is 'complete' on B, set the
corresponding cell on A as Blue interior, White text.
Otherwise, do nothing

In the example above, cells B2, B3, C3, and D3, would all be Blue/White. The
cell contents of A cannot be overwritten. Worksheet B is deleted once the
macro has finished running as it is just a temporary data store for doing
other background functions.

I have Chip Pearson's (thanks Chip!) fabulous modColorFunctions installed as
I've used it elsewhere in this workbook if that is of use here.

Thanks in advance for any help, all comments gratefully received.

Louise

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
NEED VBA TO SELECT A CELL; NOTE THE CELL VALUE;COPYADJ CELL;FIND CELL VALUE IN A RANGE AND SO ON CAPTGNVR Excel Programming 2 July 8th 07 04:18 PM
is it possible to sort the data by cell shading or cell color? L.T. Excel Discussion (Misc queries) 3 July 17th 06 08:24 PM
Conditional Cell Shading (based on the shading of other cells) Tubby Excel Worksheet Functions 2 June 20th 06 10:03 PM
change cell shading whenever contents different from previous cell zooeyhallne Excel Discussion (Misc queries) 3 June 6th 05 09:59 PM
Need a formula for returning the value of the cell shading in a cell Jesse O Excel Programming 1 August 8th 03 03:35 AM


All times are GMT +1. The time now is 12:42 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"