LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 18
Default Worksheet_SelectionChange

I have a spreadsheet with the following macro in several sheets. It changes the
fill color of the active row to yellow. It's quite handy, as the sheet is a bit
wide so it helps me keep track of what row I'm working with. It has only one
drawback (well, two). When I first open the workbook or first activate another
sheet, the active row is, of course, yellow, but when I move off of that row or
click on another row, the initial row remains yellow. The sheet then has two
rows that are yellow and remains that way unless I scroll through the active
row. That is, make the initial active row active again and then go to another
row.
Also, I can't copy (or cut) and paste from one cell to another on the same
sheet and if I want to copy to another sheet, I first have to pre-select where I
want to copy to.
Here's the code. It's adapted from (I believe) Chip Pearson's website. My
apologies if it's someone else. Any help would be gladly appreciated.

Dim z As Long

Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range)
'Exit Sub
ActiveCell.EntireRow.Interior.ColorIndex = 6

If z = Empty Then
z = ActiveCell.Row
ElseIf Not z = ActiveCell.Row Then
Rows(z).EntireRow.Interior.ColorIndex = xlColorIndexNone
End If

z = ActiveCell.Row


End Sub



 
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
Worksheet_SelectionChange Problem Casey Excel Discussion (Misc queries) 2 September 20th 05 08:23 PM
Worksheet_SelectionChange not working Bo Rasmussen New Users to Excel 1 December 13th 04 02:34 PM
worksheet_SelectionChange Event ibeetb Excel Programming 1 January 16th 04 04:05 AM
Worksheet_SelectionChange stops working jlr_nz Excel Programming 2 November 8th 03 09:08 PM
Worksheet_SelectionChange Event G R E G Excel Programming 5 August 27th 03 07:59 PM


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