Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default Detecting Worksheet change

Someone provided the following code that automatically detects a
change in a particular cell. It works great.


Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Target, Range("C6")) Is Nothing Then
Summary
End If
End Sub


I now need code to automatically detect if a change has taken place
ANYWHARE on a worksheet. Also, if I have 30 sheets and I need the
code for 26 of the 30 sheets, where do I place the code?

Your help is greatly appreciated.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Detecting Worksheet change

Hi Tim

Private Sub Worksheet_Change(ByVal Target As Range)
MsgBox "Hi"
End Sub

This will work on every cell change in the worksheet Tim
You can place this code in each Sheet Module where you want it to work

Or this one in the Thisworkbook module
This way you have one Event instead of 26
Fill in the index numbers from the sheets where the event
must not work " Case 1, 3 , 5 , 7 "



Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
Number = Sh.Index
Select Case Number
Case 1, 3 , 5 , 7
' do nothing
Case Else
MsgBox ""
End Select
End Sub


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



"Tim" wrote in message om...
Someone provided the following code that automatically detects a
change in a particular cell. It works great.


Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Target, Range("C6")) Is Nothing Then
Summary
End If
End Sub


I now need code to automatically detect if a change has taken place
ANYWHARE on a worksheet. Also, if I have 30 sheets and I need the
code for 26 of the 30 sheets, where do I place the code?

Your help is greatly appreciated.



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default Detecting Worksheet change

Thanks Ron. It works great. Your help is greatly appreciated!

"Ron de Bruin" wrote in message ...
Hi Tim

Private Sub Worksheet_Change(ByVal Target As Range)
MsgBox "Hi"
End Sub

This will work on every cell change in the worksheet Tim
You can place this code in each Sheet Module where you want it to work

Or this one in the Thisworkbook module
This way you have one Event instead of 26
Fill in the index numbers from the sheets where the event
must not work " Case 1, 3 , 5 , 7 "



Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
Number = Sh.Index
Select Case Number
Case 1, 3 , 5 , 7
' do nothing
Case Else
MsgBox ""
End Select
End Sub


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



"Tim" wrote in message om...
Someone provided the following code that automatically detects a
change in a particular cell. It works great.


Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Target, Range("C6")) Is Nothing Then
Summary
End If
End Sub


I now need code to automatically detect if a change has taken place
ANYWHARE on a worksheet. Also, if I have 30 sheets and I need the
code for 26 of the 30 sheets, where do I place the code?

Your help is greatly appreciated.

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
Detecting Calc On or Off dhstein Excel Discussion (Misc queries) 5 April 22nd 09 10:41 AM
Detecting Duplicate Sums - Worksheet code [email protected] Excel Discussion (Misc queries) 0 September 27th 07 02:20 AM
Cell value - detecting change tgmjf Excel Worksheet Functions 2 July 20th 06 08:12 PM
Detecting absentees gracegift Excel Discussion (Misc queries) 7 December 27th 04 11:35 PM
Detecting a color Duncan Help Excel Worksheet Functions 5 December 9th 04 08:12 PM


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