Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Please help. Something like,I want A1 highlighted with yellow color
everytime i click anywhere from B1 to IV1. If i move to anywhere on any cell, i want the corresponding cell on A column be highlighteg. Just like rowliner but rowliner highlights the cell that is being clicked. thank you. boogie |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Not Intersect(Target, Range("B1:IV1")) Is Nothing Then Range("A1").Interior.ColorIndex = 6 Else Range("A1").Interior.ColorIndex = xlColorIndexNone End If End Sub 'This is worksheet event code, which means that it needs to be 'placed in the appropriate worksheet code module, not a standard 'code module. To do this, right-click on the sheet tab, select 'the View Code option from the menu, and paste the code in. -- HTH Bob Phillips "boogie" wrote in message ... Please help. Something like,I want A1 highlighted with yellow color everytime i click anywhere from B1 to IV1. If i move to anywhere on any cell, i want the corresponding cell on A column be highlighteg. Just like rowliner but rowliner highlights the cell that is being clicked. thank you. boogie |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi,
as a beginner in Excel-VBA: Private Sub Worksheet_SelectionChange(ByVal Target As Range) If Not Intersect(Target, Range("B1:IV1")) Is Nothing Then Range("A1").Interior.ColorIndex = 6 Else Range("A1").Interior.ColorIndex = xlColorIndexNone End If End Sub seems to me to work only on row 1. How about this one: Private Sub Worksheet_SelectionChange(ByVal Target As Range) Dim r As Long ' row r = ActiveCell.Row Cells(r, 1).Interior.ColorIndex = 6 End Sub Of course, it is no toggle function. Once a cell is yellow, it stays yellow. I don't know how to utilize "target". Helmut Weber |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
That is because the OP asked for it to only work on row 1.
-- HTH Bob Phillips "Helmut Weber" wrote in message ... Hi, as a beginner in Excel-VBA: Private Sub Worksheet_SelectionChange(ByVal Target As Range) If Not Intersect(Target, Range("B1:IV1")) Is Nothing Then Range("A1").Interior.ColorIndex = 6 Else Range("A1").Interior.ColorIndex = xlColorIndexNone End If End Sub seems to me to work only on row 1. How about this one: Private Sub Worksheet_SelectionChange(ByVal Target As Range) Dim r As Long ' row r = ActiveCell.Row Cells(r, 1).Interior.ColorIndex = 6 End Sub Of course, it is no toggle function. Once a cell is yellow, it stays yellow. I don't know how to utilize "target". Helmut Weber |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Bob,
it seems indeed the question is more a problem than the answer. Something like, I want A1 highlighted with yellow color everytime i click anywhere from B1 to IV1 If i move to anywhere on any cell, i want the corresponding cell on A column be highlighted Helmut Weber |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Opps, i apologize to you both if my question was very clear. Actually, If i
want to click on any cell from B to IV, the corresponding cell on A should be highlighted. Let's say C1 is clicked, then A1 is highlighted. Again if G10 is clicked, then A10 is highlighted but of course the previous hightlighted cell in column A is go back to white. Something like what Helmut says, "toggle". thank you for trying to help. God bless. "Helmut Weber" wrote: Hi Bob, it seems indeed the question is more a problem than the answer. Something like, I want A1 highlighted with yellow color everytime i click anywhere from B1 to IV1 If i move to anywhere on any cell, i want the corresponding cell on A column be highlighted Helmut Weber |
#7
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi,
how about this one: Private Sub Worksheet_SelectionChange(ByVal Target As Range) Range(Cells(1, 1), Cells(Rows.Count, 1)).Interior.ColorIndex = 0 Cells(ActiveCell.Row, 1).Interior.ColorIndex = 6 End Sub Which removes all coloring from the first row, and then colors the first cell in the row in which you select a cell, in yellow. Even if it is the first cell in a row, though. Helmut Weber |
#8
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If target.column < 1 Then Range("A" & Target.Row).Interior.ColorIndex = 6 Else Range("A:A").Interior.ColorIndex = xlColorIndexNone End If End Sub -- HTH Bob Phillips "boogie" wrote in message ... Opps, i apologize to you both if my question was very clear. Actually, If i want to click on any cell from B to IV, the corresponding cell on A should be highlighted. Let's say C1 is clicked, then A1 is highlighted. Again if G10 is clicked, then A10 is highlighted but of course the previous hightlighted cell in column A is go back to white. Something like what Helmut says, "toggle". thank you for trying to help. God bless. "Helmut Weber" wrote: Hi Bob, it seems indeed the question is more a problem than the answer. Something like, I want A1 highlighted with yellow color everytime i click anywhere from B1 to IV1 If i move to anywhere on any cell, i want the corresponding cell on A column be highlighted Helmut Weber |
#9
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Bob.
I suspect that you intended something like: Private Sub Worksheet_SelectionChange(ByVal Target As Range) Range("A:A").Interior.ColorIndex = xlColorIndexNone If Target.Column < 1 Then Range("A" & Target.Row).Interior.ColorIndex = 6 End If End Sub --- Regards, Norman "Bob Phillips" wrote in message ... Private Sub Worksheet_SelectionChange(ByVal Target As Range) If target.column < 1 Then Range("A" & Target.Row).Interior.ColorIndex = 6 Else Range("A:A").Interior.ColorIndex = xlColorIndexNone End If End Sub -- HTH Bob Phillips "boogie" wrote in message ... Opps, i apologize to you both if my question was very clear. Actually, If i want to click on any cell from B to IV, the corresponding cell on A should be highlighted. Let's say C1 is clicked, then A1 is highlighted. Again if G10 is clicked, then A10 is highlighted but of course the previous hightlighted cell in column A is go back to white. Something like what Helmut says, "toggle". thank you for trying to help. God bless. "Helmut Weber" wrote: Hi Bob, it seems indeed the question is more a problem than the answer. Something like, I want A1 highlighted with yellow color everytime i click anywhere from B1 to IV1 If i move to anywhere on any cell, i want the corresponding cell on A column be highlighted Helmut Weber |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Can't format cell color/text color in Office Excel 2003 in fil | Excel Discussion (Misc queries) | |||
Make text color match cell color with macro? | Excel Discussion (Misc queries) | |||
Excel: Syntax to change cell color based on color of another cell | Excel Worksheet Functions | |||
Can't format cell color/text color in Office Excel 2003 in files . | Excel Discussion (Misc queries) | |||
Browse Forms Controls and change TextBox color based on cell color | Excel Programming |