View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
David David is offline
external usenet poster
 
Posts: 1,560
Default Simple for.. next problem

Hi Alan,
Hope this will help:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Stop
Z = Range("A1").Value
Sheets("Sheet2").Select
Application.Goto Reference:="Range1"
Selection.Find(What:=(Z), After:=ActiveCell, LookIn:=xlFormulas, LookAt _
:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:= _
False, SearchFormat:=False).Activate
ActiveCell.Select
With Selection.Borders(xlEdgeLeft)
.LineStyle = xlContinuous
.Weight = xlThin
End With
With Selection.Borders(xlEdgeTop)
.LineStyle = xlContinuous
.Weight = xlThin
End With
With Selection.Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.Weight = xlThin
End With
With Selection.Borders(xlEdgeRight)
.LineStyle = xlContinuous
.Weight = xlThin
End With
End Sub


"Alan M" wrote:

I need to use the Worksheet selectionchange event to trigger and action as
follows.

If the value in cell A1 on worksheet 1 changes then this value must be
looked up in Range 1 on worksheet 2. having found the corresponding value I
want to have a coloured shading apllied to the row in Range 2 in which the
target cell lies.

can you help please?