Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Coloring a range depending on a cell value


Hi everybody.

I have created the follwoing code to color a specific range when th
value of cell A1 =1 and uncolor it when it is more than 1.

The problem I faced is that when the code is applied the whole shee
becomes un-editable except cell A1, which contains the value.
what I want is to make the whole sheet active and editable afte
applying the follwoing code.


Code
-------------------
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Range("A1").Value = 1 And Target.Address < "$A$1" Then
Range("B2:F2").Select
With Selection.Interior
.ColorIndex = 6
End With
ElseIf Range("A1").Value 1 And Target.Address < "$A$1" Then
Range("B2:F2").Select
With Selection.Interior
.ColorIndex = 0
End With
End If
End Su
-------------------


Thank you for all

--
Jim33
-----------------------------------------------------------------------
Jim333's Profile: http://www.excelforum.com/member.php...nfo&userid=518
View this thread: http://www.excelforum.com/showthread.php?threadid=47330

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Coloring a range depending on a cell value

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Range("A1").Value = 1 And Target.Address < "$A$1" Then
Range("B2:F2").Interior.ColorIndex = 6
ElseIf Range("A1").Value 1 And Target.Address < "$A$1" Then
Range("B2:F2").Interior.ColorIndex = xlNone
End If
End Sub

--
Regards,
Tom Ogilvy


"Jim333" wrote in
message ...

Hi everybody.

I have created the follwoing code to color a specific range when the
value of cell A1 =1 and uncolor it when it is more than 1.

The problem I faced is that when the code is applied the whole sheet
becomes un-editable except cell A1, which contains the value.
what I want is to make the whole sheet active and editable after
applying the follwoing code.


Code:
--------------------
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Range("A1").Value = 1 And Target.Address < "$A$1" Then
Range("B2:F2").Select
With Selection.Interior
.ColorIndex = 6
End With
ElseIf Range("A1").Value 1 And Target.Address < "$A$1" Then
Range("B2:F2").Select
With Selection.Interior
.ColorIndex = 0
End With
End If
End Sub
--------------------


Thank you for all.


--
Jim333
------------------------------------------------------------------------
Jim333's Profile:

http://www.excelforum.com/member.php...fo&userid=5186
View this thread: http://www.excelforum.com/showthread...hreadid=473303



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Coloring a range depending on a cell value


Thank you sooooooooo much Tom

That is exactly what I want ..

Thanks alot.

Bye,


--
Jim333
------------------------------------------------------------------------
Jim333's Profile: http://www.excelforum.com/member.php...fo&userid=5186
View this thread: http://www.excelforum.com/showthread...hreadid=473303

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
Cell coloring when the value is an integer and within said range Bala Excel Worksheet Functions 3 June 2nd 08 09:41 PM
Selecting range in list of range names depending on a cell informa Courreges Excel Discussion (Misc queries) 2 June 19th 06 10:59 AM
Conditional formatting depending a range of cell Marisa Excel Worksheet Functions 2 November 1st 05 01:31 AM
Coloring a range depending on a cell value Ctech[_13_] Excel Programming 0 October 5th 05 11:01 AM
print a certain range depending what is in cell? Momo Excel Programming 1 February 24th 05 04:56 PM


All times are GMT +1. The time now is 05:27 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"