ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Worksheet_change Method (https://www.excelbanter.com/excel-programming/273804-worksheet_change-method.html)

Michael[_10_]

Worksheet_change Method
 

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

Bob Phillips[_5_]

Worksheet_change Method
 


--

HTH

Bob Phillips

"Michael" wrote in message
...

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




Ron de Bruin

Worksheet_change Method
 
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

--
Regards Ron de Bruin
(Win XP Pro SP-1 XL2002 SP-2)
www.rondebruin.nl



"Michael" wrote in message ...

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





All times are GMT +1. The time now is 05:49 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com