ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Change Event (https://www.excelbanter.com/excel-programming/395489-change-event.html)

tjh

Change Event
 
Hello,

I would like a macro to run when a specific range of cells are changed, but
I do not want it to run if any other cells are changed. For instance if any
cell in the range A1:A25 are change I would like the macro to run. But I do
not want it to run if any other cell on the worksheet is changed. Is this
possible?

Thank you,

Ronald Dodge[_2_]

Change Event
 
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Column = 1 and Target.Row < 26 Then
<Perform Macro
End If
End Sub

--

Sincerely,

Ronald R. Dodge, Jr.
Master MOUS 2000

"tjh" wrote in message
...
Hello,

I would like a macro to run when a specific range of cells are changed,
but
I do not want it to run if any other cells are changed. For instance if
any
cell in the range A1:A25 are change I would like the macro to run. But I
do
not want it to run if any other cell on the worksheet is changed. Is this
possible?

Thank you,




Jim Rech

Change Event
 
What should happen if the user changes a range of cells, some in and some
out of the specific range? Say by pasting to A20:A30 or selecting A1:B10,
C5:D15, A18:A22 typing an entry and pressing Ctrl-Enter?

--
Jim
"tjh" wrote in message
...
| Hello,
|
| I would like a macro to run when a specific range of cells are changed,
but
| I do not want it to run if any other cells are changed. For instance if
any
| cell in the range A1:A25 are change I would like the macro to run. But I
do
| not want it to run if any other cell on the worksheet is changed. Is this
| possible?
|
| Thank you,



Ronald Dodge[_2_]

Change Event
 
That is where Target.Rows.Count with Target.Row will need to be taken into
account. This is also true for Target.Columns.Count with Target.Column.

However, this could be a problem as if multiple different range selections
is selected, then a value typed in, then pressed Ctrl-Enter, which case
would also require using Target.Areas, such as

If Target.Areas.Count1 Then
'There are multiple range areas selected.
Else
'There is only one area selected.
End If

Such example of multiple areas would be like if A5:B8, A11:A15, C8:F24 were
all selected and the only cells selected, then the user typed in something
like the numeric value of "0", then pressed Ctrl-Enter.

--

Sincerely,

Ronald R. Dodge, Jr.
Master MOUS 2000

"Jim Rech" wrote in message
...
What should happen if the user changes a range of cells, some in and some
out of the specific range? Say by pasting to A20:A30 or selecting A1:B10,
C5:D15, A18:A22 typing an entry and pressing Ctrl-Enter?

--
Jim
"tjh" wrote in message
...
| Hello,
|
| I would like a macro to run when a specific range of cells are changed,
but
| I do not want it to run if any other cells are changed. For instance if
any
| cell in the range A1:A25 are change I would like the macro to run. But I
do
| not want it to run if any other cell on the worksheet is changed. Is
this
| possible?
|
| Thank you,






All times are GMT +1. The time now is 08:52 AM.

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