Worksheet_change Method

  • Thread starter Thread starter Michael
  • Start date Start date
M

Michael

Hi all,

Is it possible to expand the code below to apply it a
range of cells. At present it only works on a single cell
D13 and consequently C13.Is this possible?,

Private Sub Worksheet_Change(ByVal Target As Excel.Range)
If Target.Address <> "$D$13" Then Exit Sub
[c13].Value = Target
Range("C13").Select
With Selection.Interior
.ColorIndex = 35
.Pattern = xlSolid
End With
Selection.Font.Bold = True
End Sub

Thanks for your help

Michael
 
Hi Michael

Private Sub Worksheet_Change(ByVal Target As Excel.Range)
If Not Application.Intersect(Range("a1:a20"), Target) Is Nothing Then
MsgBox "Hi"
End If
End Sub

You can do this for a range
This will show the Msgbox if you change a cell in the range a1:a20

This will show the Msgbox if you change a othere cell then one from the range a1:a20

Private Sub Worksheet_Change(ByVal Target As Excel.Range)
If Application.Intersect(Range("a1:a20"), Target) Is Nothing Then
MsgBox "Hi"
End If
End Sub
 
Back
Top