ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   If cell value changes in 2 cells (https://www.excelbanter.com/excel-programming/427154-if-cell-value-changes-2-cells.html)

Kashyap

If cell value changes in 2 cells
 
Hi, I have a set of tasks to be done when value in E5 changes.. but I need to
do another set of tasks when value in H5 changes as well.. How to go around
it?

Barb Reinhardt

If cell value changes in 2 cells
 
In your Worksheet Change event put something like this

if Not Intersect(Target,Me.Range("E5")) is Nothing then
'Do the events for E5
end if

Repeat for H5

HTH,
Barb Reinhardt

"Kashyap" wrote:

Hi, I have a set of tasks to be done when value in E5 changes.. but I need to
do another set of tasks when value in H5 changes as well.. How to go around
it?


Jacob Skaria

If cell value changes in 2 cells
 
Selec the Worksheet Change event

Private Sub Worksheet_Change(ByVal Target As Range)

If Not Application.Intersect(Target, Range("$E$5")) Is Nothing Then
'events
End If

If Not Application.Intersect(Target, Range("$H$5")) Is Nothing Then
'events
End If

End Sub

--
If this post helps click Yes
---------------
Jacob Skaria


"Kashyap" wrote:

Hi, I have a set of tasks to be done when value in E5 changes.. but I need to
do another set of tasks when value in H5 changes as well.. How to go around
it?


Patrick Molloy[_2_]

If cell value changes in 2 cells
 
in the code for the worksheet's change event ...


Private Sub Worksheet_Change(ByVal Target As Range)

SELECT CASE Target.Address
CASE "$E$5"
' do something
CASE "$H$5"
'do something else
CASE ELSE
END SELECT

End Sub


"Kashyap" wrote:

Hi, I have a set of tasks to be done when value in E5 changes.. but I need to
do another set of tasks when value in H5 changes as well.. How to go around
it?



All times are GMT +1. The time now is 03:41 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com