Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 12
Default Row-Entire row changes color (and stays) selecting first entry

I have a sheet with 63 rows and 30 columns. I would like the row to
change color and stay as I slide across columns. Freeze panes works
almost but to change color would be better.
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 222
Default Row-Entire row changes color (and stays) selecting first entry


Assuming your data starts in A1 - Copy the following VBA - You might want
to try this on a blank Excel Worksheet to see if this is what you want.


Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim Data As Range
Dim i As Integer
Dim j As Integer
Dim k As Integer
i = 1
j = 30
k = ActiveCell.Column()
Set Data = Range("a1:ad60")

Data.Interior.ColorIndex = xlNone

If ActiveCell.Row < 1 Or ActiveCell.Row 60 Or _
ActiveCell.Column < 1 Or ActiveCell.Column 30 Then
Exit Sub

End If

ActiveCell.Offset(0, -(k - i)). _
Resize(1, 30).Interior.ColorIndex = 35


End Sub


Bob M



"Harry's GMail World" wrote:

I have a sheet with 63 rows and 30 columns. I would like the row to
change color and stay as I slide across columns. Freeze panes works
almost but to change color would be better.

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 12
Default Row-Entire row changes color (and stays) selecting first entry

On May 10, 4:01*pm, robert morris
wrote:
Assuming your data starts in A1 - Copy the following VBA *- You might want
to try this on a blank Excel Worksheet to see if this is what you want.

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim Data As Range
Dim i As Integer
Dim j As Integer
Dim k As Integer
i = 1
j = 30
k = ActiveCell.Column()
Set Data = Range("a1:ad60")

Data.Interior.ColorIndex = xlNone

If ActiveCell.Row < 1 Or ActiveCell.Row 60 Or _
* * ActiveCell.Column < 1 Or ActiveCell.Column 30 Then
* * Exit Sub

End If

ActiveCell.Offset(0, -(k - i)). _
Resize(1, 30).Interior.ColorIndex = 35

End Sub

Bob M



"Harry's GMail World" wrote:
I have a sheet with 63 rows and 30 columns. I would like the row to
change color and stay as I slide across columns. Freeze panes works
almost but to change color would be better.- Hide quoted text -


- Show quoted text -


OK..I will work on that. I would never have figured that out.
Really..thanks.
  #4   Report Post  
Posted to microsoft.public.excel.misc
Rob Rob is offline
external usenet poster
 
Posts: 718
Default Row-Entire row changes color (and stays) selecting first entry

Private Sub Worksheet_SelectionChange(ByVal Target As Range)

Dim Data As Range

'remove previous colour from region
Set Data = Range("a1:ad60")
Data.Interior.ColorIndex = xlNone

On Error GoTo ErrorHandler
Set Target = Intersect(Target, Data) 'errors if target outside
Intersect(Target.EntireRow, Data).Interior.ColorIndex = 35 'errors if no
intersection found
Exit Sub

ErrorHandler: 'if either line errored do nothing
On Error Resume Next
End Sub

"Harry's GMail World" wrote:

I have a sheet with 63 rows and 30 columns. I would like the row to
change color and stay as I slide across columns. Freeze panes works
almost but to change color would be better.

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
i want to highlight entire row when selecting a cell in that row Dino Excel Discussion (Misc queries) 12 March 30th 08 03:59 AM
Keyboard shortcut or selecting entire column Precious_Stone Excel Worksheet Functions 2 July 18th 06 05:37 PM
Conditional formatting of an entire row based on a cell text entry Gilles Desjardins Excel Discussion (Misc queries) 2 December 22nd 05 11:48 AM
selecting last entry dihirod Excel Discussion (Misc queries) 10 August 21st 05 03:44 PM
Moving cursor to another cell w/out selecting entire area Darin Excel Discussion (Misc queries) 8 May 13th 05 08:44 PM


All times are GMT +1. The time now is 12:41 PM.

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"