Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default How to change row color when select a cell in this row?

How to change row color when select a cell in this row?

Thank you

--
Message posted from http://www.ExcelForum.com

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default How to change row color when select a cell in this row?

Amolin, SelectionChange event makes this possible as follow.
If you have already colored cell in the wks, need more code.
Please note, this is just a sample code.


Code
-------------------

'Wks Module
Dim preservedRange As Range
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Not preservedRange Is Nothing Then
preservedRange.Interior.ColorIndex = xlNone
End If
Target.EntireRow.Cells.Interior.ColorIndex = 10
Set preservedRange = Target.EntireRow
End Sub

-------------------


--
Message posted from http://www.ExcelForum.com

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,885
Default How to change row color when select a cell in this row?

Hi
have a look at
http://www.cpearson.com/excel/excelM...ightActiveCell
http://www.cpearson.com/excel/RowLiner.htm


--
Regards
Frank Kabel
Frankfurt, Germany


How to change row color when select a cell in this row?

Thank you!


---
Message posted from http://www.ExcelForum.com/

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 102
Default How to change row color when select a cell in this row?

Hi Amolin try this, the other colours are saved and not overwritten when you select another row. If you need more columns than 26
increase this number in the code.

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
'Highlights the active row to column Z
Static c As Excel.Range, Rng As Excel.Range
Static n(26), x As Integer
x = 35
Dim i As Integer
Application.ScreenUpdating = False
If Not c Is Nothing Then
If c.Row = ActiveCell.Row Then Exit Sub
For i = 1 To 26
Rng.Cells(i).Interior.ColorIndex = n(i)
Next i
End If
Set c = ActiveCell
Set Rng = Range(Cells(c.Row, 1), Cells(c.Row, 26))
For i = 1 To 26
n(i) = Rng.Cells(i).Interior.ColorIndex
Next i
Rng.Interior.ColorIndex = x
End Sub


Regards Robert

"Amolin " wrote in message ...
How to change row color when select a cell in this row?

Thank you!


---
Message posted from http://www.ExcelForum.com/



---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.655 / Virus Database: 420 - Release Date: 08/04/2004


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
Why font color change back to black when I select a different cell Cody Excel Worksheet Functions 1 March 2nd 10 07:35 AM
Change tab color based on current color of a cell MarkT Excel Discussion (Misc queries) 0 May 22nd 08 05:46 PM
Excel: Syntax to change cell color based on color of another cell davew18 Excel Worksheet Functions 1 January 4th 07 01:24 PM
How to change the default Border, Font Color, and Cell Color Elijah Excel Discussion (Misc queries) 3 November 2nd 05 11:52 PM
In excell 2003 I select a cell and try to refill with any color ksv raj Excel Worksheet Functions 0 October 2nd 05 06:02 PM


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