View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Pete Csiszar Pete Csiszar is offline
external usenet poster
 
Posts: 5
Default Help with setting range limits

Thanks Izar,

But not quite.
I would like the active cell to be green when I click on it. When I leave
the cell and click or down arrow etc. the next active cell becomes green and
the cell just left behind returns to xlColorIndexNone.

Sorry for being vague.

Regards,
Pete

"Izar Arcturus" wrote in message
...
Assuming that you want to set only the Range("D7:D14") and
the Range("F7:F14") to green and that you want to only set
those ranges to green by way of VBA(not by clicking). Try
this:

Private Sub Change_To_Green()

Range("D7:D14").Interior.ColorIndex = 4
Range("F7:F14").Interior.ColorIndex = 4

End Sub

Do you have further needs for this sub?

-IA


-----Original Message-----
Hi All,

I have put together the following sub which changes the

color of whatever
cell is active to green.

Private Sub Workbook_SheetSelectionChange(ByVal Sh As

Object, ByVal Target
As Excel.Range)
Static DataField As Range
If Not DataField Is Nothing Then
DataField.Interior.ColorIndex = xlColorIndexNone
End If
Target.Interior.ColorIndex = 4
Set DataField = Target

End Sub


My problem is that I have been unable to limit this

routine to a specific
range of cells (actually two specific ranges) in this

case D7:D14 and F7:F14

As it is right now, no matter what cell I click on, it

turns green.

Any help would be much appreciated.

Pete


.