Worksheet.Change process

Sam173

New Member
Joined
Aug 8, 2024
Messages
2
Office Version
  1. 365
Platform
  1. Windows
Two questions -
I am trying to write a code to run few worksheet changes depending on changes in value of ONLY one cell $A$4. I don't want any other changes in the worksheet to do anything.
So I ran below sample code on a blank worksheet.

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Address = "$A$4" Then
Range("$B$4").Value = "changed"
End If
Range("$C$4").Value = "not changed"

End Sub

With this, even when I just click on one of the cells the event is triggered. (i.e. I am not writing anything in the cell, just clicking on it.
My question -

1) Is it then true that the worksheet.change code is running in the background all the time catching any changes but doing nothing? Is that not overhead slowing excel sheet down?
2) Why is it triggering when only clicking on the cell, is there a way to trigger only when something is manually entered in the cell?
 

Excel Facts

Convert text numbers to real numbers
Select a column containing text numbers. Press Alt+D E F to quickly convert text to numbers. Faster than "Convert to Number"
Welcome to the Board!

The issue is you are using "Worksheet_SelectionChange", which runs whenever any cell is selected.
You want "Worksheet_Change", which only runs when a cell is updated.
 
Upvote 0
Welcome to the Board!

The issue is you are using "Worksheet_SelectionChange", which runs whenever any cell is selected.
You want "Worksheet_Change", which only runs when a cell is updated.
thank you, appreciate the quick input
 
Upvote 0
You are welcome.
Glad I was able to help!
 
Upvote 0

Forum statistics

Threads
1,224,821
Messages
6,181,163
Members
453,021
Latest member
Justyna P

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top