Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default Recognizing cell change in a Sub Worksheet_Change procedure

The Event should fire.

Private Sub Worksheet_Change(ByVal Target As Range)
If Intersect(Target, Range("D10")) Is Nothing Then
Exit Sub
Else
MsgBox ("ccc")
End If
End Sub

Gets activated from :
Sub gsnu()
MsgBox ("start")
Range("A1").Copy Range("D10")
MsgBox ("end")
End Sub


Make sure that Application.EnableEvents is not being set to False
--
Gary's Student


"AMY Z." wrote:

Hi,
The procedure below works great if I manually enter a value in A1. I have
another macro that copies and pastes a certain row into row1. The procedure
below won't change if I run the copy and paste macro, even though A1 has
changed.
Is there a way around this so the code below recognizes a change by copy and
pasting?

Private Sub Worksheet_Change(ByVal Target As Range)

If Target.Address = "$A$1" Then
With Worksheets("Sheet2")
.Rows("1:35").EntireRow.Hidden = False
If Target.Text = "Apples" Then
.Rows("10:10").EntireRow.Hidden = True
.Rows("20:20").EntireRow.Hidden = True
ElseIf Target.Text = "Pears" Then
.Rows("15:15").EntireRow.Hidden = True
.Rows("25:25").EntireRow.Hidden = True
ElseIf Target.Text = "Oranges" Then
.Rows("30:30").EntireRow.Hidden = True
.Rows("35:35").EntireRow.Hidden = True
Else
.Rows("12:12").EntireRow.Hidden = True
.Rows("16:16").EntireRow.Hidden = True
End If
End With
End If
End Sub

I hope I explained so you can understand.
Thank you your time in advance,
Amy

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
Recognizing cell change in a Sub Worksheet_Change procedure Dave Peterson Excel Programming 3 December 30th 06 11:18 PM
Recognizing cell change in a Sub Worksheet_Change procedure JNW Excel Programming 0 December 29th 06 07:33 PM
Worksheet_Change procedure [email protected] Excel Programming 0 September 3rd 04 02:08 AM
Worksheet_Change procedure [email protected] Excel Programming 1 September 3rd 04 01:48 AM
Worksheet_Change procedure [email protected] Excel Programming 1 September 3rd 04 01:23 AM


All times are GMT +1. The time now is 05:43 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"