ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Code won't kick off (https://www.excelbanter.com/excel-programming/429584-code-wont-kick-off.html)

Joe_Hunt via OfficeKB.com

Code won't kick off
 
I realize this is probably simple and I'm missing the obvious, but I can't
see what's going on. I have coding in a couple of sheets in my workbook that
should kick off various instructions when a particular cell is changed, but
it's not doing it although it used to. The security settings are right (set
on low actually). Can anybody give me an idea of what to look at? Here's the
coding in one of the worksheets if that helps:

Private Sub Worksheet_Change(ByVal Target As Range)

If Target.Address = "D1" Then
Application.ScreenUpdating = False
ExceptionsStart
Application.ScreenUpdating = True
End If
End Sub

In the above example when the value in cell D1 is changed it should run the
macro "ExceptionsStart" which leads into others as that one finishes. I do
appreciate any help.

--
Message posted via http://www.officekb.com


Dave Peterson

Code won't kick off
 
The .Address will return something like $A$1--with those dollar signs.

So you can use:
If Target.Address = "$D$1" Then
or
If Target.Address(0,0) = "D1" Then
or the one I like:

if target.cells.count 1 then exit sub 'singl cell only
if intersect(target, me.range("D1")) is nothing then exit sub




"Joe_Hunt via OfficeKB.com" wrote:

I realize this is probably simple and I'm missing the obvious, but I can't
see what's going on. I have coding in a couple of sheets in my workbook that
should kick off various instructions when a particular cell is changed, but
it's not doing it although it used to. The security settings are right (set
on low actually). Can anybody give me an idea of what to look at? Here's the
coding in one of the worksheets if that helps:

Private Sub Worksheet_Change(ByVal Target As Range)

If Target.Address = "D1" Then
Application.ScreenUpdating = False
ExceptionsStart
Application.ScreenUpdating = True
End If
End Sub

In the above example when the value in cell D1 is changed it should run the
macro "ExceptionsStart" which leads into others as that one finishes. I do
appreciate any help.

--
Message posted via http://www.officekb.com


--

Dave Peterson

Ardus Petus[_2_]

Code won't kick off
 
The default result of .Address method of Range object is an absolute
address,
so you should write :

If Target.Address = "$D$1"

HTH
--
AP

"Joe_Hunt via OfficeKB.com" <u45578@uwe a écrit dans le message de news:
97593c6d7ba9c@uwe...
I realize this is probably simple and I'm missing the obvious, but I can't
see what's going on. I have coding in a couple of sheets in my workbook
that
should kick off various instructions when a particular cell is changed,
but
it's not doing it although it used to. The security settings are right
(set
on low actually). Can anybody give me an idea of what to look at? Here's
the
coding in one of the worksheets if that helps:

Private Sub Worksheet_Change(ByVal Target As Range)

If Target.Address = "D1" Then
Application.ScreenUpdating = False
ExceptionsStart
Application.ScreenUpdating = True
End If
End Sub

In the above example when the value in cell D1 is changed it should run
the
macro "ExceptionsStart" which leads into others as that one finishes. I do
appreciate any help.

--
Message posted via http://www.officekb.com




Joe_Hunt via OfficeKB.com

Code won't kick off
 
I figured it would be something easy. Thanks to all three of you!

Ardus Petus wrote:
The default result of .Address method of Range object is an absolute
address,
so you should write :

If Target.Address = "$D$1"

HTH
--
AP

I realize this is probably simple and I'm missing the obvious, but I can't
see what's going on. I have coding in a couple of sheets in my workbook

[quoted text clipped - 20 lines]
macro "ExceptionsStart" which leads into others as that one finishes. I do
appreciate any help.


--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...mming/200906/1


Joe_Hunt via OfficeKB.com

Code won't kick off
 
Got it. Thanks again!

Dave Peterson wrote:
Search for .enableevents
and that may help.

I don't see where it was turned off and then not turned back on, but I re-
enabled events at the end of the auto-open and everything seems to work now.

[quoted text clipped - 22 lines]
--
Message posted via http://www.officekb.com



--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...mming/200906/1



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

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