#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default cell color

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default cell color

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 163
Default cell color

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default cell color

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 163
Default cell color

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default cell color

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
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
Can't format cell color/text color in Office Excel 2003 in fil Tony S Excel Discussion (Misc queries) 1 December 21st 07 01:41 PM
Make text color match cell color with macro? JoeSpareBedroom Excel Discussion (Misc queries) 1 June 26th 07 07:09 PM
Excel: Syntax to change cell color based on color of another cell davew18 Excel Worksheet Functions 1 January 4th 07 01:24 PM
Can't format cell color/text color in Office Excel 2003 in files . albertaman Excel Discussion (Misc queries) 0 February 16th 06 03:56 AM
Browse Forms Controls and change TextBox color based on cell color StefanW Excel Programming 2 November 21st 04 07:06 PM


All times are GMT +1. The time now is 06:12 AM.

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"