Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
How can I high light a group of cells from different active cells? For
example, when cell A1 is the active cell, I would like to high light cells D1:F3, A2 highlight cells D5:F7 etc. |
#2
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
By "highlight" do you mean "select" or "change color"?
If change color, do you want D1:F3 uncolored when D5:F7 are colored? What is the extent of "etc."? Gord Dibben MS Excel MVP On Mon, 16 Apr 2007 09:26:05 -0700, village_idiot wrote: How can I high light a group of cells from different active cells? For example, when cell A1 is the active cell, I would like to high light cells D1:F3, A2 highlight cells D5:F7 etc. |
#3
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Use an event macro:
Private Sub Worksheet_SelectionChange(ByVal Target As Range) Cells.Interior.ColorIndex = xlNone If Intersect(Target, Range("A1")) Is Nothing Then Else Range("D1:F3").Interior.ColorIndex = 6 End If If Intersect(Target, Range("A2")) Is Nothing Then Else Range("D5:F7").Interior.ColorIndex = 6 End If End Sub This goes in Worksheet code, not a standard module. -- Gary''s Student - gsnu200715 |
#4
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
That's for the info, I'll try it after work. In answer to Gord Dibben, I
have to do this 81 times. I made a spread sheet to help play Sudoku. "Gary''s Student" wrote: Use an event macro: Private Sub Worksheet_SelectionChange(ByVal Target As Range) Cells.Interior.ColorIndex = xlNone If Intersect(Target, Range("A1")) Is Nothing Then Else Range("D1:F3").Interior.ColorIndex = 6 End If If Intersect(Target, Range("A2")) Is Nothing Then Else Range("D5:F7").Interior.ColorIndex = 6 End If End Sub This goes in Worksheet code, not a standard module. -- Gary''s Student - gsnu200715 |
#5
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
I sould say Thanks not That's
"village_idiot" wrote: That's for the info, I'll try it after work. In answer to Gord Dibben, I have to do this 81 times. I made a spread sheet to help play Sudoku. "Gary''s Student" wrote: Use an event macro: Private Sub Worksheet_SelectionChange(ByVal Target As Range) Cells.Interior.ColorIndex = xlNone If Intersect(Target, Range("A1")) Is Nothing Then Else Range("D1:F3").Interior.ColorIndex = 6 End If If Intersect(Target, Range("A2")) Is Nothing Then Else Range("D5:F7").Interior.ColorIndex = 6 End If End Sub This goes in Worksheet code, not a standard module. -- Gary''s Student - gsnu200715 |
#6
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Maybe, instead of re-inventing wheel, you could download Andy Pope's sudoku
puzzle generator and solver. http://www.andypope.info/fun/sudoku.htm On Mon, 16 Apr 2007 10:12:03 -0700, village_idiot wrote: That's for the info, I'll try it after work. In answer to Gord Dibben, I have to do this 81 times. I made a spread sheet to help play Sudoku. "Gary''s Student" wrote: Use an event macro: Private Sub Worksheet_SelectionChange(ByVal Target As Range) Cells.Interior.ColorIndex = xlNone If Intersect(Target, Range("A1")) Is Nothing Then Else Range("D1:F3").Interior.ColorIndex = 6 End If If Intersect(Target, Range("A2")) Is Nothing Then Else Range("D5:F7").Interior.ColorIndex = 6 End If End Sub This goes in Worksheet code, not a standard module. -- Gary''s Student - gsnu200715 |
#7
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
One more question, I take it that 6 is the color, is there a list of the
different colors and their numbers? "Gary''s Student" wrote: Use an event macro: Private Sub Worksheet_SelectionChange(ByVal Target As Range) Cells.Interior.ColorIndex = xlNone If Intersect(Target, Range("A1")) Is Nothing Then Else Range("D1:F3").Interior.ColorIndex = 6 End If If Intersect(Target, Range("A2")) Is Nothing Then Else Range("D5:F7").Interior.ColorIndex = 6 End If End Sub This goes in Worksheet code, not a standard module. -- Gary''s Student - gsnu200715 |
#8
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Yes 6 is a nice bright yellow.
In: http://www.mvps.org/dmcritchie/excel/colors.htm see the section: ColorIndex -- 56 Excel Colors [#colors56/#colorindex] for a complete list -- Gary''s Student - gsnu200715 "village_idiot" wrote: One more question, I take it that 6 is the color, is there a list of the different colors and their numbers? "Gary''s Student" wrote: Use an event macro: Private Sub Worksheet_SelectionChange(ByVal Target As Range) Cells.Interior.ColorIndex = xlNone If Intersect(Target, Range("A1")) Is Nothing Then Else Range("D1:F3").Interior.ColorIndex = 6 End If If Intersect(Target, Range("A2")) Is Nothing Then Else Range("D5:F7").Interior.ColorIndex = 6 End If End Sub This goes in Worksheet code, not a standard module. -- Gary''s Student - gsnu200715 |
#9
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Again thanks for the help, but I'm having problems and the debug program says
that the problem is with the line that reads "Cells.Interior.ColorIndex = x|none". The worksheet has some cells of different colors already, how do I change that line to keep the other cells color and only change the ranges of cells I want changed "Gary''s Student" wrote: Use an event macro: Private Sub Worksheet_SelectionChange(ByVal Target As Range) Cells.Interior.ColorIndex = xlNone If Intersect(Target, Range("A1")) Is Nothing Then Else Range("D1:F3").Interior.ColorIndex = 6 End If If Intersect(Target, Range("A2")) Is Nothing Then Else Range("D5:F7").Interior.ColorIndex = 6 End If End Sub This goes in Worksheet code, not a standard module. -- Gary''s Student - gsnu200715 |
#10
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Intersect(Target, Range("A1")) Is Nothing Then Else Range("D1:F3").Interior.ColorIndex = 6 Range("D5:F7").Interior.ColorIndex = xlNone End If If Intersect(Target, Range("A2")) Is Nothing Then Else Range("D5:F7").Interior.ColorIndex = 6 Range("D1:F3").Interior.ColorIndex = xlNone End If End Sub This version does not clear all the formats, just the ones the logic is controlling -- Gary''s Student - gsnu200715 |
#11
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Again, thanks and a question. Can I name the range of cells? Like I said
I'm going to have 81 cells to do this with, with about 629 cells for each of the 81 to clear of color. I'm sorry to be such a pain, but I'm self taught and so far I haven't taught myself anything about this kind of stuff, but I'm learning from you. "Gary''s Student" wrote: Private Sub Worksheet_SelectionChange(ByVal Target As Range) If Intersect(Target, Range("A1")) Is Nothing Then Else Range("D1:F3").Interior.ColorIndex = 6 Range("D5:F7").Interior.ColorIndex = xlNone End If If Intersect(Target, Range("A2")) Is Nothing Then Else Range("D5:F7").Interior.ColorIndex = 6 Range("D1:F3").Interior.ColorIndex = xlNone End If End Sub This version does not clear all the formats, just the ones the logic is controlling -- Gary''s Student - gsnu200715 |
#12
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
You are not a pain. This is fun. Yes you can use Named Ranges ( which we
can define in either the worksheet or the macro). We can gives names to each of the small blocks of cells and make a super range by combining them. Or if all the small blocks are in cols D-F, then we can clear the color out of just these three columns and paint the color in the selected small block. There are lots of options. -- Gary''s Student - gsnu200715 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Get Address of Active Cell | Excel Discussion (Misc queries) | |||
value of the active cell | Excel Worksheet Functions | |||
Active Cell Color | Excel Discussion (Misc queries) | |||
HOW TO COPY 480 ACTIVE E-MAIL ADDRESSES CLM "G" ON AN ACTIVE EXCE. | Excel Discussion (Misc queries) | |||
Sum to active cell | Excel Discussion (Misc queries) |