Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Using Worksheet_Change to Auto Run a Macro

I've been doing a lot of searching today and cannot figure out my
problem.

Background: Using Excel 2002 and Windows XP. VB code opens Excel
file and dumps data into the workbook.

Once it dumps the data into the workbork I want to run a macro. I've
been trying to use Worksheet_Change to do this. Basically when a cell
changes (or has data dumped into it) I want my macro to run.

Here is a sample of the code I was trying to use:


Private Sub Worksheet_Change(ByVal Target As Range)

If Target.Address = "$N$6" Then
Call Macro2

End If

End Sub


I barely know what I'm doing so please be gentle with me.

Any help will be appreciated!
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Using Worksheet_Change to Auto Run a Macro

Your code worked fine for me in xl97 when I pasted into N6 alone. If you
paste into multiple cells (will fire if only pasting into N6 as well).

Private Sub Worksheet_Change(ByVal Target As Range)

If not Intersect(Target, Range("N6")) is nothing Then
Call Macro2

End If

End Sub


--
Regards,
Tom Ogilvy



Katrina wrote in message
m...
I've been doing a lot of searching today and cannot figure out my
problem.

Background: Using Excel 2002 and Windows XP. VB code opens Excel
file and dumps data into the workbook.

Once it dumps the data into the workbork I want to run a macro. I've
been trying to use Worksheet_Change to do this. Basically when a cell
changes (or has data dumped into it) I want my macro to run.

Here is a sample of the code I was trying to use:


Private Sub Worksheet_Change(ByVal Target As Range)

If Target.Address = "$N$6" Then
Call Macro2

End If

End Sub


I barely know what I'm doing so please be gentle with me.

Any help will be appreciated!



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,337
Default Using Worksheet_Change to Auto Run a Macro

I might do it like this:
If Target.Address < "$N$6" Then exit sub
Call Macro2

End If

"Katrina" wrote in message
m...
I've been doing a lot of searching today and cannot figure out my
problem.

Background: Using Excel 2002 and Windows XP. VB code opens Excel
file and dumps data into the workbook.

Once it dumps the data into the workbork I want to run a macro. I've
been trying to use Worksheet_Change to do this. Basically when a cell
changes (or has data dumped into it) I want my macro to run.

Here is a sample of the code I was trying to use:


Private Sub Worksheet_Change(ByVal Target As Range)

If Target.Address = "$N$6" Then
Call Macro2

End If

End Sub


I barely know what I'm doing so please be gentle with me.

Any help will be appreciated!



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
Trigger Macro by Worksheet_Change JSnow Excel Discussion (Misc queries) 5 October 2nd 08 06:27 PM
Worksheet_Change Event - Macro kills copy and paste Alan Excel Programming 5 September 23rd 03 02:58 AM
auto-filter change not triggering worksheet_change event mark Excel Programming 1 September 19th 03 03:01 PM
worksheet_change vs. calculate, and worksheet_change not running Tom Ogilvy Excel Programming 1 July 14th 03 02:51 AM
worksheet_change vs. calculate, and worksheet_change not running Ross[_5_] Excel Programming 0 July 13th 03 04:27 PM


All times are GMT +1. The time now is 09: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"