#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 40
Default MACRO HELP

I have a macro that changes a cell value, for example it changes the
value of cell "A1", I have another macro that I have set to run in the
worksheet_change event when "A1" is changed. My problem is when I run
the first macro and it changes the value in "A1" in doesn't run the
second macro. Is there something I need to do so it will recognize the
change in "A1" and consider it as the target so my second macro will
run?

Any help would be greatly appreciated.

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default MACRO HELP

Does the first macro disable events?

--
Regards,
Tom Ogilvy

" wrote:

I have a macro that changes a cell value, for example it changes the
value of cell "A1", I have another macro that I have set to run in the
worksheet_change event when "A1" is changed. My problem is when I run
the first macro and it changes the value in "A1" in doesn't run the
second macro. Is there something I need to do so it will recognize the
change in "A1" and consider it as the target so my second macro will
run?

Any help would be greatly appreciated.


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default MACRO HELP

One suggestion is not to use hard codes for Text cells
Declaring cell as Const. Then I simply change the const statement rather
than changing a lot of code.

" wrote:

I have a macro that changes a cell value, for example it changes the
value of cell "A1", I have another macro that I have set to run in the
worksheet_change event when "A1" is changed. My problem is when I run
the first macro and it changes the value in "A1" in doesn't run the
second macro. Is there something I need to do so it will recognize the
change in "A1" and consider it as the target so my second macro will
run?

Any help would be greatly appreciated.


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 573
Default MACRO HELP

On Feb 14, 11:17 am, Joel wrote:
One suggestion is not to use hard codes for Text cells
Declaring cell as Const. Then I simply change the const statement rather
than changing a lot of code.



" wrote:
I have a macro that changes a cell value, for example it changes the
value of cell "A1", I have another macro that I have set to run in the
worksheet_change event when "A1" is changed. My problem is when I run
the first macro and it changes the value in "A1" in doesn't run the
second macro. Is there something I need to do so it will recognize the
change in "A1" and consider it as the target so my second macro will
run?


Any help would be greatly appreciated.- Hide quoted text -


- Show quoted text -


If I remember, you can't declare a cell, since it's not an object in
the Object Model. You have to declare the range, in this case, a
single cell.

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 40
Default MACRO HELP

Yeah I had the code set like this

Application.EnableEvents = False
'code
'code
'code
'more code
Application.Run "MyMacro"
Application.EnableEvents = True

If I take out the EnableEvents line is works however know in my second
macro I have it creating a validation list in a cell that is offset
from the target. It works when I change the cell manually but when my
first macro changes the cell I get a runtime error '1004': Application-
defined or Object defined error. Any ideas why?



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default MACRO HELP

I think people would have to see all the code to suggest anything. Indicate
which line is highlighted when you get the error message. Also indicate
where the elements of the code are located - in a general module or in a
sheet module and if in a sheet module, which sheet module each is in.

I suspect your problem is in a reference - so if you qualify all your range
references with what sheet they are located on, then perhaps that will solve
the problem.

this may be true for the reference you are using in the data validation as
well.

--
Regards,
Tom Ogilvy


" wrote:

Yeah I had the code set like this

Application.EnableEvents = False
'code
'code
'code
'more code
Application.Run "MyMacro"
Application.EnableEvents = True

If I take out the EnableEvents line is works however know in my second
macro I have it creating a validation list in a cell that is offset
from the target. It works when I change the cell manually but when my
first macro changes the cell I get a runtime error '1004': Application-
defined or Object defined error. Any ideas why?


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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Macro recorded... tabs & file names changed, macro hangs Steve Excel Worksheet Functions 3 October 30th 09 11:41 AM
Macro Help Needed - Excel 2007 - Print Macro with Auto Sort Gavin Excel Worksheet Functions 0 May 17th 07 01:20 PM
Need syntax for RUNning a Word macro with an argument, called from an Excel macro Steve[_84_] Excel Programming 3 July 6th 06 07:42 PM
macro to delete entire rows when column A is blank ...a quick macro vikram Excel Programming 4 May 3rd 04 08:45 PM
Start Macro / Stop Macro / Restart Macro Pete[_13_] Excel Programming 2 November 21st 03 05:04 PM


All times are GMT +1. The time now is 11:23 AM.

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

About Us

"It's about Microsoft Excel"