Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Nigel Bennett
 
Posts: n/a
Default Worksheet Changes and applying code

In a workbook I have multiple worksheets and I can code it
to do a certain things on the change function of each
worksheet, But if I change any cell the code runs, what I
am looking for is something that when I change a
particular value in a range say from B3 to Z3, if any of
those values are changed then I want my code to run,
otherwise ignore it.

so for example the user changes the value in cell C5
nothing happens, but they then change the value in cell P3
the code will run

Hope this is clear. Also where would I put the code to
make it work on the worksheet or in a module

Thanks


  #2   Report Post  
JE McGimpsey
 
Posts: n/a
Default

You can't keep the worksheet_change event code from running when a
change is made on the sheet, but you can apply your code only to your
desired range:

Private Sub Worksheet_Change(ByVal Target As Excel.Range)
If Not Intersect(Target, Range("B3:Z3")) Is Nothing Then
'Do stuff
End If
End Sub




In article ,
"Nigel Bennett" wrote:

In a workbook I have multiple worksheets and I can code it
to do a certain things on the change function of each
worksheet, But if I change any cell the code runs, what I
am looking for is something that when I change a
particular value in a range say from B3 to Z3, if any of
those values are changed then I want my code to run,
otherwise ignore it.

so for example the user changes the value in cell C5
nothing happens, but they then change the value in cell P3
the code will run

Hope this is clear. Also where would I put the code to
make it work on the worksheet or in a module

Thanks

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



All times are GMT +1. The time now is 07:10 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"