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: 73
Default SelectionChange Question

Below is code I am using in a worksheet where the following are headers:

Columns: A1:H1
Rows: A2:A100

Right now, the entire row 1 and the entire column A are filled with the
color I have selected in the script which brings all into the print area.

Can you tell me how to specify the ranges to just the headers, instead of
the entire columns please?

Thanks in advance,

Scott

/////////////////////////////////////

Private Sub worksheet_selectionchange(ByVal target As Excel.Range)

If Cells(1, 1) = "OFF" Then
Exit Sub
End If

C = ActiveCell.Column
R = ActiveCell.Row

Dim Rng1 As Range
Set Rng1 = Range(Cells(1, C), Cells(1, C))

Dim Rng2 As Range
Set Rng2 = Range(Rows(1), Rows(1))

Dim Rng3 As Range
Set Rng3 = Range(Columns(1), Columns(1))

Dim Rng4 As Range
Set Rng4 = Cells(R, 1)

With Rng2
.Interior.Color = RGB(192, 192, 192)
End With

With Rng3
.Interior.Color = RGB(192, 192, 192)
End With

With Rng1
.Interior.Color = RGB(255, 255, 0)
End With

With Rng4
.Interior.Color = RGB(255, 255, 0)
End With

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
XL2002 - SelectionChange Question... Trevor Williams Excel Programming 2 October 13th 08 02:20 PM
From SelectionChange into UserForm Mac Excel Programming 1 April 27th 08 11:35 PM
SelectionChange Alex McDermott Excel Programming 1 May 3rd 07 03:54 PM
SelectionChange Event Squid[_3_] Excel Programming 5 February 11th 04 01:57 PM
SelectionChange - What am I doing wrong? Doug[_9_] Excel Programming 4 January 2nd 04 02:46 AM


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