Macro triggered when Data is changed and worksheet is deselected

Hi,

I have a worksheet by the name "Raw Data".

I want that if data in this worksheet is modified in any cell ( please note
data only, not formats etc..) then if the user selects any other worksheet
after changing data in "Raw Data" then a macro by the name Macro 1 should
run.

That is I want the macro to run only if the data is changed and ALSO only
when the user leaves the particular worksheet. If s/he is working on "Raw
Data" and switches to another workbook and switches back to worksheet "Raw
Data" then the macro shouldnt run (Because user will be copying data between
from other workbooks to the worksheet Raw Data.)

Please guide me for the code(syntax) and where I should put/stick this code.

Regards,
Hari
India


0
excel_hari (160)
7/22/2004 10:12:20 PM
excel.misc 78881 articles. 5 followers. Follow

1 Replies
280 Views

Similar Articles

[PageSpeed] 52

Rightclick on that worksheet's tab and select view code.

Use the dropdowns on the top of the right hand window to choose:
Worksheet
and
Deactivate

You should see something like:

Option Explicit
Private Sub Worksheet_Deactivate()

End Sub

And if you want to learn more about what events are:

Chip Pearson has some notes about events at:
http://www.cpearson.com/excel/events.htm

David McRitchie also has notes at:
http://www.mvps.org/dmcritchie/excel/event.htm

Chip has a note near the bottom of his page where you can download EventSeq.xls
to see what runs when.


Hari wrote:
> 
> Hi,
> 
> I have a worksheet by the name "Raw Data".
> 
> I want that if data in this worksheet is modified in any cell ( please note
> data only, not formats etc..) then if the user selects any other worksheet
> after changing data in "Raw Data" then a macro by the name Macro 1 should
> run.
> 
> That is I want the macro to run only if the data is changed and ALSO only
> when the user leaves the particular worksheet. If s/he is working on "Raw
> Data" and switches to another workbook and switches back to worksheet "Raw
> Data" then the macro shouldnt run (Because user will be copying data between
> from other workbooks to the worksheet Raw Data.)
> 
> Please guide me for the code(syntax) and where I should put/stick this code.
> 
> Regards,
> Hari
> India

-- 

Dave Peterson
ec35720@msn.com
0
ec35720 (10082)
7/23/2004 1:50:55 AM
Reply:

Similar Artilces:

Macro warning with no macros
I have a workbook that when I try to open it I get the warning tellin me it contains macros and asking whether I want to Enable or Disabl them. I put no macros, no VB scripts, nothing at all in the workboo other than standard Excel formulas and some charts. I developed it i Excel 2002, SP-2, but have moved it back and forth between tw computers, the other which has Excel 97. Regardless of whether Enable or Disable or change the security settings so as not to get th warning, once the workbook is open even if I go t Tools-Macro-Macros... it lists no macros. How can I find out what's cau...

Allow change to Activity Views in MS CRM
a CRM Administrator should be able to customise Activity Views and change the views to reflect pecific information eg of views Signed on Users Activites Closed /Open My Open Activites My Closed Activites Should, but unfortunately in the current release, they can't. This will be addressed in CRM 2005 though. Matt Parks MVP - Microsoft CRM ---------------------------------------- ---------------------------------------- On Thu, 10 Mar 2005 21:57:03 -0800, "N.Pinto" <N.Pinto@discussions.microsoft.com> wrote: a CRM Administrator should be able to customise Activity Views...

Macro
Can anybody tell me how to kick off a macro automatically as file is opened? Regards ...

Macro
Version: 2008 Operating System: Mac OS X 10.4 (Tiger) Processor: intel Hi, I'm thinking of buying Mac: Office 2008, but before I do I want to check that I will be able to download Scritpsmart collection of templates without any glitches: <http://www.bbc.co.uk/writersroom/scriptsmart/faq.shtml> Does anyone know if I can do this? Regards, SP. In article <ee98ff5.-1@webcrossing.caR9absDaxw>, StregaItalia@officeformac.com wrote: > Version: 2008 > Operating System: Mac OS X 10.4 (Tiger) > Processor: intel > > Hi, > > I'm thinking of buying Mac: Of...

Is there a formular or format to change 1 to one
Is there a formular or format to change a number "1" into the word "one". Hi Kevin, See: http://www.xldynamic.com/source/xld.xlFAQ0004.html --- Regards, Norman "Kevin" <Kevin@discussions.microsoft.com> wrote in message news:3C099B0B-82F6-44FB-AD72-B0F726256F96@microsoft.com... > Is there a formular or format to change a number "1" into the word "one". See http://www.xldynamic.com/source/xld.xlFAQ0004.html -- HTH RP (remove nothere from the email address if mailing direct) "Kevin" <Kevin@discussions.micro...

Run macro automatically.
How do I make a macro run automatically when a worksheet it is attached to is loaded? right click on the sheet tab>view code>left window worksheet>right window activate -- Don Guillett SalesAid Software donaldb@281.com "Excel macro" <Excel macro@discussions.microsoft.com> wrote in message news:DD7AF1E3-9263-4523-AC49-A43ABA1AB9D0@microsoft.com... > How do I make a macro run automatically when a worksheet it is attached to is > loaded? I am unable to find "activate " when I right click on worksheet. ( i assume that you are referring to the windo...

Help with macro/and or formula?
Perhaps this is a silly question, but i just can't figure out how t format this worksheet. The problem is that a lot of the cells hav numbers in them with negative signs in the back instead of in the fron (ie. 23-) and i was wondering if anyone knew of a macro/formula i coul use to quickly fix this problem for all the cells. I would b extremely grateful. Thanks -- brefed1 ----------------------------------------------------------------------- brefed15's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=3557 View this thread: http://www.excelforum.com/showthre...

Changing Rows to Columns
Is it possible to easily rotate a spreadsheet or part of a spreadshet, to change the data in rows to columns? Do to a sorting problem in the charts I create, it seems I have to sort the data in the spreadsheet first. Any help would be appreciated. Hi, Sure is a way. select & copy your data. then select the cell where you want to re-paste; right-click and select paste special; in the dialog box check "transpose". Ok. jeff >-----Original Message----- >Is it possible to easily rotate a spreadsheet or part of a >spreadshet, to change the data in rows to columns? D...

Attached Toolbars Macros
Excel 2003 I have a custom tool bar, this tool bar has several items, each item is pointing to a VBA code. This tool bar is attached to the worksheet. I've copied this spreadsheet to several computers. After I copied the spreadsheet I decided to rename the spreadsheet, after I renamed the spreadsheet the Toolbar Item's macros were still pointing to the old name, I reasigned each tool bar item to the current spreadsheet, saved the spreadsheet and everything was working on my computer, but when I re-copied the new spreadsheet to other computers and I clicked on the Toolbar Item...

How to make worksheet name as variable?
In my workbook, some formulas are like this: =SUMPRODUCT(($E2<'sheet01'!$G$1:$G$500)*($F2>'sheet01'!$G$1:$G$500)*($C2='sheet01'!$E$1:$E$500)*($B2='sheet01'!$F$1:$F$500),'sheet01'!$J$1:$J$500) 'sheet01' is the name of one of my worksheets. It appears several time in the worksheet. When I want to make them refer to another worksheet, I have to change many instances of the name. Can I input the worksheet name into one of the cells, and the formulas get the name from the cell, so that I just have to change it once? Thanks in advance!! ...

Protected sheets and running macros
i have a sheet with a macro ran by a normal button at the top. Howeve when i protect the worksheet where ever i click on the sheet the macr executes. Can any one offer any advice on how to stop this? Thanks Robert -- Message posted from http://www.ExcelForum.com hi, i am not able to reproduce the problem, hence i may not be able t provide a panacea for that issue. here is what i suggest. i have a sheet that has a macro that is run when a control toolbo button (that is, not a form button) is clicked. this sheet is protected based on the user logged in. what i have don is to protect t...

Data files
What is the difference between the **.mbf and **.mny files? In microsoft.public.money, duhmel wrote: >What is the difference between the **.mbf and **.mny files? > *.mbf is Money Backup File. You cannot do salv.exe or standard repair directly to a *.mbf file. ...

Macro Freezes Reading Pane
I have a macro that Sends/Receives Tasks from Project Server into Outlook Tasks. Everything is working fine, except one weird thing that happens. I have the Timer set on the macro and it starts as soon as Outlook starts. The macro gets the tasks from ProjectServer every hour. As soon as the macro starts running the Reading pane freezes in the Inbox. If i stop the macro then Reading pane is back to normal. Can anyone please tell me if there is something I can do in VBA to fix this annoying issue. Thanks a lot ...

Macro to remove rows?
Hi, I receive thousands of rows of data from an extract that comes from a database. The data extract automatically generates page headers that need to be removed, and I would love to automate this process. The headers do have a pattern to them, but I'm not clever enough to figure out a good way to use that to write a macro. The first row of the header starts with hyphens ------------------------------- Then there's a variable number of rows of header data to delete followed by another row of hyphens ------------------------------- Then 2 additional rows that must be deleted. The nu...

change background graphic for all slides
I am working with a .potx file and I would like to change the background image. I did a search in this newsgroup, and found advice in many threads, to change the photo (which I'm able to do), and then to check the box/option that allows you to apply the change to all slides. I cannot see where I am given this choice (to apply the new photo as a background to all slides). I do want to retain all the text that is on top of the photo, just change the background. How, with PPT 2007, can I do this? Hi RIGHT click on a blank area of the slide Format Background > Picture > File...

Duplicate Data
One main form with two subforms (linked by ProjectID), first subform is for data entry, the second just allows the user to view what has been saved from the previous subform. The subform allows users to report on a month basis by selecting a month in a combo box [PeriodID]. I would like to add some code in the Befire Update event that checks the PeriodID for a match before it is saved. Can someone help me with the code please, I have tried various DLookup snippets of code from this site, but nothing is working as the code does not really suit my purpose. regards Maybe t...

Calling on a macro within a macro!
Hey All!! Quick Question - How do you call up a macro within a current macro? I have one big macro and I need it to jump to several other macros when it runs! Does it matter where the other macros are stored or is it better to have them all in one module? Help appreciated Thnx! Hi Mellowe, '=============>> Public Sub Main() 'Your code Call One 'your code End Sub '<<============= '=============>> Public Sub One() MsgBox "Hi from One" End Sub '<<============= > Does it matter where the other macros are stored or ...

Change default "Show names from the:" option
Clicking the "To:" button in a new Outlook email message brings up the "Select Names" dialog box. This dialog displays the contents of contact databases such as My Outlook Address Book and Global Address List. Is there a way to change the default database selected in the "Show names from the:" line from the current Global Address List to the contacts in my Outlook Address Book? My version of Outlook connects with an Exchange server to acces mail, contacts, etc. Thanks for any suggestions, Kerry You probably meant to post your Outlook version so we coul...

shortcut keys to macros
Hi, Is it at all possible to assign shortcut keys to macros in Outlook? Thx, Hans ...

retrieving data from a table on a website
There is a internet page with chemical data : http://spreadsheets.google.com/pub?key=twQ35hFIq-y0N84xQ5l0ICQ&output=html It has chemicals in the first column and proerties in adjacent columns. Is there a way to have a userform lookup a chemical in a textbox from the websites 1st column and then populate other textboxes with the adjacent data from the table? Can anyone help? Thanks, Roger On Jan 18, 9:59=A0am, Roger on Excel <RogeronEx...@discussions.microsoft.com> wrote: > There is a internet page with chemical data : > > http://spreadsheets.googl...

help Unable to record Macro !!!!!!!
I want to record a macro in excel.But as soon as I click record Macro it says "unable to record" macro. Got no help in excel help.I do this same thing in word and it's working. Please help It's urgent for me !!!1 Have a look here http://groups.google.com/groups?as_epq=unable%20to%20record&as_ugroup=microsoft.public.excel.* -- Don Guillett SalesAid Software donaldb@281.com "ash" <anonymous@discussions.microsoft.com> wrote in message news:3e0b01c42ae5$45333e00$a401280a@phx.gbl... > I want to record a macro in excel.But as soon as I click > record...

decimal point in worksheet
Y'all: I have a spreadsheet where I want to display a time as "min:sec". My worksheet formula for this is =INT(C2) & ":" & INT((C2-INT(C2))*60) No problem. Except that I want it to display like this: "30:03", not "30:3". How can I do this? e.g. Here is what I get: Time (minutes) Time (minutes:seconds) 30.050 30:3 Here is what I want: Time (minutes) Time (minutes:seconds) 30.050 30:03 I put the spreadsheet out on my website at http://webpages.charter.net/rwpatterson357/temp/test.xls thanks, russ Russ o...

Macro that password protects a sheet
I am attempting to create a macro that can open a protected sheet, change something, and then protect it again. I continue to have an issue with the macro not entering the password. Is this possible to do/fix? Thanks, Ryan ..open password="mypassword" -- Don Guillett SalesAid Software donaldb@281.com "Ryan" <Ryan@discussions.microsoft.com> wrote in message news:D4780ED8-CA1D-4284-97BC-3576160D998E@microsoft.com... > I am attempting to create a macro that can open a protected sheet, change > something, and then protect it again. I continue to have an iss...

Is there functionality to audit changes made to records in CRM 3.0
I'm looking to find out if there's a way to audit the changes made to records such as accounts in CRM 3.0. I'm specifically looking to track who an account was assigned to in the past, when it was assigned, etc. Thanks in advance! Have you Tried the c360 tool http://www.c360.com/Audit.aspx "XMcknight" wrote: > I'm looking to find out if there's a way to audit the changes made to records > such as accounts in CRM 3.0. I'm specifically looking to track who an > account was assigned to in the past, when it was assigned, etc. > > Thanks i...

Data Text to Columns
I have a large column and would like to split it for the literal that says "Company Name" and then have the company name right next to it which is enterable. I tried using Data/Text to Columns, Fixed Width, sliding the arrow after Company Name: and it did not seem to split the column. I also tried putting an arrow out a ways so that there looked as though there were two defined fields and that didn't seem to work either. Am I approaching this the right way??? HELP!!! Thanks! Hi this is not possible in Excel. You have to use two columns for this -- Regards Frank Kabel Fr...