Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default By selecting a cell - change color in a range

I am trying to change the color in a range of cells that is triggered
by selecting a separate cell. Example-- select A1 and the range
d5:f10 changes to green. Select another cell - A2 and the previous
selection goes back to its original color and the range associated
with A2 is then changed to green. Etc.... This would be similar to
A1 being a button, but there will be data entered into A1. Any
advice???

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,124
Default By selecting a cell - change color in a range


You can right click the sheet tabview codeleft window select
worksheetright window use _selectionchangewrite your code
Give more examples such as always 3 rows more than the selection and always
cof d:f, etc
and it could be pretty simple to code
--
Don Guillett
SalesAid Software

"hampster" wrote in message
oups.com...
I am trying to change the color in a range of cells that is triggered
by selecting a separate cell. Example-- select A1 and the range
d5:f10 changes to green. Select another cell - A2 and the previous
selection goes back to its original color and the range associated
with A2 is then changed to green. Etc.... This would be similar to
A1 being a button, but there will be data entered into A1. Any
advice???


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default By selecting a cell - change color in a range

There is not a set formula such as always 3 rows more than the
selection. Each cell is assigned a range of cells. There are many in
the worksheet. Here are a few actual assignments. A1 - O2:Q4, A2 -
O5:Q6, B2 - R2:T4. In other words, each reference cell refers to a
block of 9 cells. Each cell already contains conditional formatting.
I need some code that recognizes that cell A1 (or other cell) has been
clicked on and then based on which cell is clicked, color a
corresponding range of nine cells and then change back when another is
clicked. A1 (or other cell) may be empty or have data in it.

On Apr 30, 10:55 am, "Don Guillett" wrote:
You can right click the sheet tabview codeleft window select
worksheetright window use _selectionchangewrite your code
Give more examples such as always 3 rows more than the selection and always
cof d:f, etc
and it could be pretty simple to code
--
Don Guillett
SalesAid Software
"hampster" wrote in message

oups.com...



I am trying to change the color in a range of cells that is triggered
by selecting a separate cell. Example-- select A1 and the range
d5:f10 changes to green. Select another cell - A2 and the previous
selection goes back to its original color and the range associated
with A2 is then changed to green. Etc.... This would be similar to
A1 being a button, but there will be data entered into A1. Any
advice???- Hide quoted text -


- Show quoted text -



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,124
Default By selecting a cell - change color in a range

right click sheet tabview codeinsert thismodify to suitSAVE

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
On Error Resume Next
If Target.Address = "$A$1" Then Set x = Range("d5:e6")
If Target.Address = "$A$2" Then Set x = Range("d8:e10")
'etc
Cells.Interior.ColorIndex = xlNone
x.Interior.ColorIndex = 6
End Sub
--
Don Guillett
SalesAid Software

"hampster" wrote in message
oups.com...
There is not a set formula such as always 3 rows more than the
selection. Each cell is assigned a range of cells. There are many in
the worksheet. Here are a few actual assignments. A1 - O2:Q4, A2 -
O5:Q6, B2 - R2:T4. In other words, each reference cell refers to a
block of 9 cells. Each cell already contains conditional formatting.
I need some code that recognizes that cell A1 (or other cell) has been
clicked on and then based on which cell is clicked, color a
corresponding range of nine cells and then change back when another is
clicked. A1 (or other cell) may be empty or have data in it.

On Apr 30, 10:55 am, "Don Guillett" wrote:
You can right click the sheet tabview codeleft window select
worksheetright window use _selectionchangewrite your code
Give more examples such as always 3 rows more than the selection and
always
cof d:f, etc
and it could be pretty simple to code
--
Don Guillett
SalesAid Software
"hampster" wrote in message

oups.com...



I am trying to change the color in a range of cells that is triggered
by selecting a separate cell. Example-- select A1 and the range
d5:f10 changes to green. Select another cell - A2 and the previous
selection goes back to its original color and the range associated
with A2 is then changed to green. Etc.... This would be similar to
A1 being a button, but there will be data entered into A1. Any
advice???- Hide quoted text -


- Show quoted text -




  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default By selecting a cell - change color in a range

Excellent!!!

Exactly what I was after.
Thank you.



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,124
Default By selecting a cell - change color in a range

Glad it helped. The trick is to not destroy the other formatting.

--
Don Guillett
SalesAid Software

"hampster" wrote in message
ups.com...
Excellent!!!

Exactly what I was after.
Thank you.


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
Conditional to change cell color by Selecting Cells maperalia Excel Discussion (Misc queries) 4 June 24th 07 06:53 AM
How do I change cell color based upon data range within the cell? Chris Sanders Excel Worksheet Functions 1 March 6th 06 08:59 PM
change fill color of a range of cells based on color of a cell? DarMelNel Excel Programming 0 March 2nd 06 06:35 PM
Dynamically change cell range in formula by background color? [email protected] Excel Programming 1 January 9th 06 09:08 PM
HOW TO USE A FORMULA TO CHANGE CELL COLOR ACCORDING TO DATE RANGE. terry Excel Worksheet Functions 2 December 27th 04 04:07 AM


All times are GMT +1. The time now is 09:04 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"