Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 425
Default worksheet change based on target range



Want to automatically run macro if range within worksheet is changed
in any way.

Range is L15:L1000.

Maco name is "stank".

Please assist....

Thanx
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,986
Default worksheet change based on target range

This assumes that stank is in the standard code module1 and that this code
will be put into the applicable sheet code module.

Private Sub Worksheet_Change(ByVal target As Range)
Set sRng = Range("L15:L1000")
If target = Intersect(target, sRng) Then
stank
End If
End Sub




"J.W. Aldridge" wrote:



Want to automatically run macro if range within worksheet is changed
in any way.

Range is L15:L1000.

Maco name is "stank".

Please assist....

Thanx

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default worksheet change based on target range

Suggest change

If target = Intersect(target, sRng) Then

to
If Not Intersect(target, sRng) Is Nothing Then

Regards,
Peter T


"JLGWhiz" wrote in message
...
This assumes that stank is in the standard code module1 and that this code
will be put into the applicable sheet code module.

Private Sub Worksheet_Change(ByVal target As Range)
Set sRng = Range("L15:L1000")
If target = Intersect(target, sRng) Then
stank
End If
End Sub




"J.W. Aldridge" wrote:



Want to automatically run macro if range within worksheet is changed
in any way.

Range is L15:L1000.

Maco name is "stank".

Please assist....

Thanx



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,986
Default worksheet change based on target range

Probably less likely to throw an Oject Variable Not Set error that way.
Thanks Pete.

"Peter T" wrote:

Suggest change

If target = Intersect(target, sRng) Then

to
If Not Intersect(target, sRng) Is Nothing Then

Regards,
Peter T


"JLGWhiz" wrote in message
...
This assumes that stank is in the standard code module1 and that this code
will be put into the applicable sheet code module.

Private Sub Worksheet_Change(ByVal target As Range)
Set sRng = Range("L15:L1000")
If target = Intersect(target, sRng) Then
stank
End If
End Sub




"J.W. Aldridge" wrote:



Want to automatically run macro if range within worksheet is changed
in any way.

Range is L15:L1000.

Maco name is "stank".

Please assist....

Thanx




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
Add Borders based on ByVal Target As Range Marty Excel Programming 5 September 20th 06 04:09 PM
Need to determine the ROW of the TARGET in a Worksheet Change Even Barb Reinhardt Excel Programming 4 August 4th 06 02:12 PM
Excel VBA Target Worksheet change [email protected] Excel Discussion (Misc queries) 1 March 2nd 06 02:33 PM
Worksheet Change Event- Refer to Target Address By Name Jm Excel Programming 2 May 21st 04 02:34 AM
Many Sub Worksheet_Change(ByVal Target As Range) In One Worksheet MathewPBennett Excel Programming 4 December 24th 03 01:01 PM


All times are GMT +1. The time now is 03:14 PM.

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"