Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 12
Default Change cell background color based on content that results from li

This could be very simple, but I will lay the groundwork first. I have a
schedule spreadsheet that I import data to from a web based program. There
are existing filters to remove all formatting of the data and remove that
which we do not use. What remains is a non formatted sheet that other
workbooks link to so we can produce daily sheets. Now the data that is
linked on the other sheets may be for example the number 150. It appears
throughout the sheet and I would like to color any cell that contains the
number 150. The problem is I can't search for 150 because it really doesn't
exist. All that exists is the linked cell refernece to where this page gets
the data from.

The action I want to learn to produce is that, based on the resulting data,
color the cell(s) the chosen color. Something to the effect of if any cell
in workbook1 contains number 150, resulting from a link to a cell in
workbooka1, to be colored blue. This makes every occurance of 150 in a cell
change the cell background blue. I would like to have this formulated for
about 25 conditions.

I am willing to do all the work, all the training, all the coding, whatever
I need to so that I can make this work as we use this weekly and have to
manually alter background colors. I don't want to buy something to do it
since once I establish this formatting code it will not change very often if
at all.

Thank you in advance for any guidance and help you might provide!
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 457
Default Change cell background color based on content that results from li

For that many conditions, you'll want to use a macro most likely. Since this
will be imported data, I'll assume you'll run this macro after the import.
First, here's the macro you can use:

'================
Sub FormatColors()
For Each c In ActiveSheet.UsedRange

xCheck = c.Value
With c.Interior
Select Case xCheck

'Each case represents the value to look for
'and the ColorIndex corresponds to the color
'you want the background to be
Case 100
..ColorIndex = 6
Case 150
..ColorIndex = 9
'Repeat as necessary....

Case Else
'If not a previous condition, no fill
..ColorIndex = 0
End Select
End With
Next
End Sub
'================

'To create a key showing which number corresponds to which color
'you can run this quick macro, which uses row number to represent color
'Run this macro on a blank sheet

Sub CreateKey()
For i = 1 to 56
Cells(i,1).Interior.ColorIndex = i
Next
End Sub

--
Best Regards,

Luke M
"joemc911" wrote in message
...
This could be very simple, but I will lay the groundwork first. I have a
schedule spreadsheet that I import data to from a web based program.
There
are existing filters to remove all formatting of the data and remove that
which we do not use. What remains is a non formatted sheet that other
workbooks link to so we can produce daily sheets. Now the data that is
linked on the other sheets may be for example the number 150. It appears
throughout the sheet and I would like to color any cell that contains the
number 150. The problem is I can't search for 150 because it really
doesn't
exist. All that exists is the linked cell refernece to where this page
gets
the data from.

The action I want to learn to produce is that, based on the resulting
data,
color the cell(s) the chosen color. Something to the effect of if any
cell
in workbook1 contains number 150, resulting from a link to a cell in
workbooka1, to be colored blue. This makes every occurance of 150 in a
cell
change the cell background blue. I would like to have this formulated for
about 25 conditions.

I am willing to do all the work, all the training, all the coding,
whatever
I need to so that I can make this work as we use this weekly and have to
manually alter background colors. I don't want to buy something to do it
since once I establish this formatting code it will not change very often
if
at all.

Thank you in advance for any guidance and help you might provide!



  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 561
Default Change cell background color based on content that results fro

Luke,
Would you be so kind to send me your E-Mail address to:
micky-a <at tapuz.co.il
Thanks, Micky


"Luke M" wrote:

For that many conditions, you'll want to use a macro most likely. Since this
will be imported data, I'll assume you'll run this macro after the import.
First, here's the macro you can use:

'================
Sub FormatColors()
For Each c In ActiveSheet.UsedRange

xCheck = c.Value
With c.Interior
Select Case xCheck

'Each case represents the value to look for
'and the ColorIndex corresponds to the color
'you want the background to be
Case 100
..ColorIndex = 6
Case 150
..ColorIndex = 9
'Repeat as necessary....

Case Else
'If not a previous condition, no fill
..ColorIndex = 0
End Select
End With
Next
End Sub
'================

'To create a key showing which number corresponds to which color
'you can run this quick macro, which uses row number to represent color
'Run this macro on a blank sheet

Sub CreateKey()
For i = 1 to 56
Cells(i,1).Interior.ColorIndex = i
Next
End Sub

--
Best Regards,

Luke M
"joemc911" wrote in message
...
This could be very simple, but I will lay the groundwork first. I have a
schedule spreadsheet that I import data to from a web based program.
There
are existing filters to remove all formatting of the data and remove that
which we do not use. What remains is a non formatted sheet that other
workbooks link to so we can produce daily sheets. Now the data that is
linked on the other sheets may be for example the number 150. It appears
throughout the sheet and I would like to color any cell that contains the
number 150. The problem is I can't search for 150 because it really
doesn't
exist. All that exists is the linked cell refernece to where this page
gets
the data from.

The action I want to learn to produce is that, based on the resulting
data,
color the cell(s) the chosen color. Something to the effect of if any
cell
in workbook1 contains number 150, resulting from a link to a cell in
workbooka1, to be colored blue. This makes every occurance of 150 in a
cell
change the cell background blue. I would like to have this formulated for
about 25 conditions.

I am willing to do all the work, all the training, all the coding,
whatever
I need to so that I can make this work as we use this weekly and have to
manually alter background colors. I don't want to buy something to do it
since once I establish this formatting code it will not change very often
if
at all.

Thank you in advance for any guidance and help you might provide!



.

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 12
Default Change cell background color based on content that results fro

Thank you so much for the answer Luke! It appears right in line with what I
thought. May I make one more request, though. While I understand what you
are saying to do I don't know exactly how to do it. I don't know how to
create and run the macro nor how to use the macro to give me a color key
page. I am imagining I have to paste the code you provided into VB somehow.
I just don't have any real training or idea how to do this. I could use
pointers on the color key page as well, but am guessing this might just be
transparent once I learn the other part.

In any case, thanks again for such quick help! I'm lloking forward to being
able to put it in to practice!

Joe M

"Luke M" wrote:

For that many conditions, you'll want to use a macro most likely. Since this
will be imported data, I'll assume you'll run this macro after the import.
First, here's the macro you can use:

'================
Sub FormatColors()
For Each c In ActiveSheet.UsedRange

xCheck = c.Value
With c.Interior
Select Case xCheck

'Each case represents the value to look for
'and the ColorIndex corresponds to the color
'you want the background to be
Case 100
..ColorIndex = 6
Case 150
..ColorIndex = 9
'Repeat as necessary....

Case Else
'If not a previous condition, no fill
..ColorIndex = 0
End Select
End With
Next
End Sub
'================

'To create a key showing which number corresponds to which color
'you can run this quick macro, which uses row number to represent color
'Run this macro on a blank sheet

Sub CreateKey()
For i = 1 to 56
Cells(i,1).Interior.ColorIndex = i
Next
End Sub

--
Best Regards,

Luke M
"joemc911" wrote in message
...
This could be very simple, but I will lay the groundwork first. I have a
schedule spreadsheet that I import data to from a web based program.
There
are existing filters to remove all formatting of the data and remove that
which we do not use. What remains is a non formatted sheet that other
workbooks link to so we can produce daily sheets. Now the data that is
linked on the other sheets may be for example the number 150. It appears
throughout the sheet and I would like to color any cell that contains the
number 150. The problem is I can't search for 150 because it really
doesn't
exist. All that exists is the linked cell refernece to where this page
gets
the data from.

The action I want to learn to produce is that, based on the resulting
data,
color the cell(s) the chosen color. Something to the effect of if any
cell
in workbook1 contains number 150, resulting from a link to a cell in
workbooka1, to be colored blue. This makes every occurance of 150 in a
cell
change the cell background blue. I would like to have this formulated for
about 25 conditions.

I am willing to do all the work, all the training, all the coding,
whatever
I need to so that I can make this work as we use this weekly and have to
manually alter background colors. I don't want to buy something to do it
since once I establish this formatting code it will not change very often
if
at all.

Thank you in advance for any guidance and help you might provide!



.

  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 694
Default Change cell background color based on content that results fro

Hi Joemc911
The link below is a sample worksheet with Luke M's macro. Slightly modified so
you can play with it.
http://cjoint.com/?dyplLsnupa
Let us know if that is really what you want.
HTH
John
P.S. I may not be able to help you with macros, I'm just starting to learn, but
someone else will, if your questions are clear with examples.

"joemc911" wrote in message
...
Thank you so much for the answer Luke! It appears right in line with what I
thought. May I make one more request, though. While I understand what you
are saying to do I don't know exactly how to do it. I don't know how to
create and run the macro nor how to use the macro to give me a color key
page. I am imagining I have to paste the code you provided into VB somehow.
I just don't have any real training or idea how to do this. I could use
pointers on the color key page as well, but am guessing this might just be
transparent once I learn the other part.

In any case, thanks again for such quick help! I'm lloking forward to being
able to put it in to practice!

Joe M

"Luke M" wrote:

For that many conditions, you'll want to use a macro most likely. Since this
will be imported data, I'll assume you'll run this macro after the import.
First, here's the macro you can use:

'================
Sub FormatColors()
For Each c In ActiveSheet.UsedRange

xCheck = c.Value
With c.Interior
Select Case xCheck

'Each case represents the value to look for
'and the ColorIndex corresponds to the color
'you want the background to be
Case 100
..ColorIndex = 6
Case 150
..ColorIndex = 9
'Repeat as necessary....

Case Else
'If not a previous condition, no fill
..ColorIndex = 0
End Select
End With
Next
End Sub
'================

'To create a key showing which number corresponds to which color
'you can run this quick macro, which uses row number to represent color
'Run this macro on a blank sheet

Sub CreateKey()
For i = 1 to 56
Cells(i,1).Interior.ColorIndex = i
Next
End Sub

--
Best Regards,

Luke M
"joemc911" wrote in message
...
This could be very simple, but I will lay the groundwork first. I have a
schedule spreadsheet that I import data to from a web based program.
There
are existing filters to remove all formatting of the data and remove that
which we do not use. What remains is a non formatted sheet that other
workbooks link to so we can produce daily sheets. Now the data that is
linked on the other sheets may be for example the number 150. It appears
throughout the sheet and I would like to color any cell that contains the
number 150. The problem is I can't search for 150 because it really
doesn't
exist. All that exists is the linked cell refernece to where this page
gets
the data from.

The action I want to learn to produce is that, based on the resulting
data,
color the cell(s) the chosen color. Something to the effect of if any
cell
in workbook1 contains number 150, resulting from a link to a cell in
workbooka1, to be colored blue. This makes every occurance of 150 in a
cell
change the cell background blue. I would like to have this formulated for
about 25 conditions.

I am willing to do all the work, all the training, all the coding,
whatever
I need to so that I can make this work as we use this weekly and have to
manually alter background colors. I don't want to buy something to do it
since once I establish this formatting code it will not change very often
if
at all.

Thank you in advance for any guidance and help you might provide!



.


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
Change background color of cell based on vlookup in cell Antney Excel Discussion (Misc queries) 1 October 19th 09 10:55 PM
change background color based on range value DanL New Users to Excel 2 February 6th 09 09:35 PM
change the color of cell background based on a result Rich Excel Worksheet Functions 2 January 27th 09 07:17 PM
Change background color based on value in column A JT Innovations Excel Discussion (Misc queries) 4 January 23rd 09 07:14 PM
how to change a cell color based on its content using macro? Ranger888 New Users to Excel 6 December 15th 08 08:23 PM


All times are GMT +1. The time now is 11:39 PM.

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

About Us

"It's about Microsoft Excel"