Run macro automatically.

How do I make a macro run automatically when a worksheet it is attached to is 
loaded?
0
Macro (4)
4/18/2005 6:40:03 PM
excel.newusers 15348 articles. 2 followers. Follow

7 Replies
2247 Views

Similar Articles

[PageSpeed] 58

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?


0
Don
4/18/2005 6:50:00 PM
I am unable to find "activate " when I right click on worksheet. ( i assume 
that you are  referring to the windows explorer kind of interface which opens 
up on the left of the visula basic window) . Sorry! I am new to excel and 
many thanks for your quick response.

"Don Guillett" wrote:

> 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?
> 
> 
> 
0
sheela (5)
4/18/2005 7:24:02 PM
Hi

See Chip Pearson's site for more info
http://www.cpearson.com/excel/events.htm

Example code :

Sub Auto_open()
MsgBox "Hi"
End Sub

Must be in a normal module
If you use a Auto_open macro then this wil not run if you open the file with a macro

Or a event

Private Sub Workbook_Open()
   'macro name or code
End Sub

Right click on the Excel icon next to File in the menubar
And choose View code

You are now in the Thisworkbook module
Paste the Event in this place
Alt-Q to go back to Excel
Save and close the file



-- 
Regards Ron de Bruin
http://www.rondebruin.nl



"Sheela" <Sheela@discussions.microsoft.com> wrote in message news:2CA4C492-9A7D-43D0-B10D-FD84F6623B23@microsoft.com...
>I am unable to find "activate " when I right click on worksheet. ( i assume
> that you are  referring to the windows explorer kind of interface which opens
> up on the left of the visula basic window) . Sorry! I am new to excel and
> many thanks for your quick response.
>
> "Don Guillett" wrote:
>
>> 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?
>>
>>
>> 


0
rondebruin (3790)
4/18/2005 8:12:46 PM
You said worksheet. To us that means each tab within the workbook which is
the file....

-- 
Don Guillett
SalesAid Software
donaldb@281.com
"Sheela" <Sheela@discussions.microsoft.com> wrote in message
news:2CA4C492-9A7D-43D0-B10D-FD84F6623B23@microsoft.com...
> I am unable to find "activate " when I right click on worksheet. ( i
assume
> that you are  referring to the windows explorer kind of interface which
opens
> up on the left of the visula basic window) . Sorry! I am new to excel and
> many thanks for your quick response.
>
> "Don Guillett" wrote:
>
> > 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?
> >
> >
> >


0
Don
4/18/2005 10:33:13 PM
Thanks a bunch...It works. Also how do I make the macro run automatically 
whenever the value in a cell changes?

"Ron de Bruin" wrote:

> Hi
> 
> See Chip Pearson's site for more info
> http://www.cpearson.com/excel/events.htm
> 
> Example code :
> 
> Sub Auto_open()
> MsgBox "Hi"
> End Sub
> 
> Must be in a normal module
> If you use a Auto_open macro then this wil not run if you open the file with a macro
> 
> Or a event
> 
> Private Sub Workbook_Open()
>    'macro name or code
> End Sub
> 
> Right click on the Excel icon next to File in the menubar
> And choose View code
> 
> You are now in the Thisworkbook module
> Paste the Event in this place
> Alt-Q to go back to Excel
> Save and close the file
> 
> 
> 
> -- 
> Regards Ron de Bruin
> http://www.rondebruin.nl
> 
> 
> 
> "Sheela" <Sheela@discussions.microsoft.com> wrote in message news:2CA4C492-9A7D-43D0-B10D-FD84F6623B23@microsoft.com...
> >I am unable to find "activate " when I right click on worksheet. ( i assume
> > that you are  referring to the windows explorer kind of interface which opens
> > up on the left of the visula basic window) . Sorry! I am new to excel and
> > many thanks for your quick response.
> >
> > "Don Guillett" wrote:
> >
> >> 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?
> >>
> >>
> >> 
> 
> 
> 
0
sheela (5)
4/19/2005 1:28:04 PM
use a worksheet_CHANGE event

-- 
Don Guillett
SalesAid Software
donaldb@281.com
"Sheela" <Sheela@discussions.microsoft.com> wrote in message
news:2C4540A3-6FAE-4632-ABA9-34EA27466F26@microsoft.com...
> Thanks a bunch...It works. Also how do I make the macro run automatically
> whenever the value in a cell changes?
>
> "Ron de Bruin" wrote:
>
> > Hi
> >
> > See Chip Pearson's site for more info
> > http://www.cpearson.com/excel/events.htm
> >
> > Example code :
> >
> > Sub Auto_open()
> > MsgBox "Hi"
> > End Sub
> >
> > Must be in a normal module
> > If you use a Auto_open macro then this wil not run if you open the file
with a macro
> >
> > Or a event
> >
> > Private Sub Workbook_Open()
> >    'macro name or code
> > End Sub
> >
> > Right click on the Excel icon next to File in the menubar
> > And choose View code
> >
> > You are now in the Thisworkbook module
> > Paste the Event in this place
> > Alt-Q to go back to Excel
> > Save and close the file
> >
> >
> >
> > -- 
> > Regards Ron de Bruin
> > http://www.rondebruin.nl
> >
> >
> >
> > "Sheela" <Sheela@discussions.microsoft.com> wrote in message
news:2CA4C492-9A7D-43D0-B10D-FD84F6623B23@microsoft.com...
> > >I am unable to find "activate " when I right click on worksheet. ( i
assume
> > > that you are  referring to the windows explorer kind of interface
which opens
> > > up on the left of the visula basic window) . Sorry! I am new to excel
and
> > > many thanks for your quick response.
> > >
> > > "Don Guillett" wrote:
> > >
> > >> 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?
> > >>
> > >>
> > >>
> >
> >
> >


0
Don
4/19/2005 2:52:59 PM
Hi sheela

See Chip's site
look for the change event

On this page you can see how you can use it
http://www.rondebruin.nl/mail/change.htm

-- 
Regards Ron de Bruin
http://www.rondebruin.nl



"Sheela" <Sheela@discussions.microsoft.com> wrote in message news:2C4540A3-6FAE-4632-ABA9-34EA27466F26@microsoft.com...
> Thanks a bunch...It works. Also how do I make the macro run automatically
> whenever the value in a cell changes?
>
> "Ron de Bruin" wrote:
>
>> Hi
>>
>> See Chip Pearson's site for more info
>> http://www.cpearson.com/excel/events.htm
>>
>> Example code :
>>
>> Sub Auto_open()
>> MsgBox "Hi"
>> End Sub
>>
>> Must be in a normal module
>> If you use a Auto_open macro then this wil not run if you open the file with a macro
>>
>> Or a event
>>
>> Private Sub Workbook_Open()
>>    'macro name or code
>> End Sub
>>
>> Right click on the Excel icon next to File in the menubar
>> And choose View code
>>
>> You are now in the Thisworkbook module
>> Paste the Event in this place
>> Alt-Q to go back to Excel
>> Save and close the file
>>
>>
>>
>> -- 
>> Regards Ron de Bruin
>> http://www.rondebruin.nl
>>
>>
>>
>> "Sheela" <Sheela@discussions.microsoft.com> wrote in message news:2CA4C492-9A7D-43D0-B10D-FD84F6623B23@microsoft.com...
>> >I am unable to find "activate " when I right click on worksheet. ( i assume
>> > that you are  referring to the windows explorer kind of interface which opens
>> > up on the left of the visula basic window) . Sorry! I am new to excel and
>> > many thanks for your quick response.
>> >
>> > "Don Guillett" wrote:
>> >
>> >> 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?
>> >>
>> >>
>> >>
>>
>>
>> 


0
rondebruin (3790)
4/19/2005 3:01:43 PM
Reply:

Similar Artilces:

What processor(sys requirements) should my computer have to run the following:
Hello I have developed a series of reports using pivot tables, multiple vlookup functions. Example: Report 1 has a database of 20000plus records, from which I created a pivot table. In addition, I have 2 columns which return values using a vlookup everytime I refresh the pivot table. These Vlookup formulas read information from another database, but this database if for 2000 records only My computer spends around 5 minutes calculaing everytime a single change is done (it often crashes) In addition, my job requires me to have open applications as Outlook, and Oracle(manufacturing system...

A Macro required or where to start or is it possible ?
Hi there, I have a Excel file with 31 sheets in it - 1 per day. Basically I am looking for a macro of some sort that would do the following. [1] Bring up a Data entry screen to enter data on to the required sheet based on the date (eg. if the date is 17/03/07 then it will enter this data on to the next blank line on sheet 17. [2] That at the bottom of the list it will insert the totals for the respective columns. Obviously this line will move down the list if rows are inserted. Here is an idea of what is being entered. Lment A/C Code Customer Allocation Status Amount Payment ...

Running a workflow on demand
I have 5000 accounts I want to run a workflow on to update data and process new data I have imported. How can I select the full list of 5000 accounts to run the workflow on? I understand that this is not possible, but is on the wishlist for a future release. "CSP" wrote: > I have 5000 accounts I want to run a workflow on to update data and process > new data I have imported. How can I select the full list of 5000 accounts to > run the workflow on? Try this free tool to change the number of records per page (not a supported fix, but if it works for you then all good...

How to create e-mail addresses based on group membership in E2K3 running on W2K3
Hello, I need to create different email address for different users in my Exchange 2003 server running on Windows Server 2003. I would like to be able to do this by using AD group membership and Exchange recipient policies rules. I have browsed MS support.microsoft.com web site and found KB 317298 ( http://support.microsoft.com/kb/317298 )and also looked at www.msexchange.org . Both articles seem very straight forward. When I get to modifying the rule in "Recipient Policies" this is where I get lost. I have used adsiedit.msc to lookup my group which is called "Dogfood E...

Automatically run Macro at specific time
How do I automatically run a macro at a specific time each day. Ex. run macro at 8:00 each work morning. Thanks And Chip Pearson has some very nice notes at: http://www.cpearson.com/excel/ontime.htm You also may want to look at a scheduler program (some versions of windows have this built in, but there are lots of shareware programs that do it, too (www.shareware.com).) Then that windows scheduler program can start your file at 8:00 and your workbook could have an auto_open macro that runs when the workbook opens. Gizmo wrote: > > How do I automatically run a macro at a specifi...

Excel macro question #3
Hi, Could anyone tell me how to write a macro that will automatically copy two colums in an Excel worksheet and at the start of each day insert them into a new worksheet with the new date on it? The columns in the new worksheet are named differently than the previous day's (i.e. Beginning bag count, instead of ending bag count). I've taken a VB programming course but have not done any programming in Excel yet. Any help with this would be most appreciated. Joan Have included an example sub routine, that might help (obviously not the definitive solution, but it should get y...

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...

Can Word 2000 run under Windows 7?
More in hope than expectation, I just tried installing Word 2000 (from the complete Works Suite 2000) on a brand-new PC running Windows 7 Home Premium. The installation appeared to go perfectly, but when I first tried to launch the program I got this message: "Required registry information is missing and this application cannot run. Please run setup again to correct this problem." A bit of Googling turned up the information that this message can turn up in Windows XP and Vista too, so it doesn't seem to be particular to 7. But none of the information I've f...

How do I setup automatic return reciept for one person in Outlook
I have n employee who constantly insists he's not receiving my messages. Is there a way to set up return receipt for one particular person? Not without some in depth changes to how you a send email to that person. You could use an email message that you have saved with the option for a read receipt turned on and only use that message form for emails to this person. Of course, that person may decline sending you the RR if they so desire. --� Milly Staples [MVP - Outlook] Post all replies to the group to keep the discussion intact. All unsolicited mail sent to my personal account ...

Macro won't move in proper progression
I created a macro to place a border on the left "wall" of a cell and then move my cursor 3 cells to the right and stop. Instead, each time I use the macro, the cursor returns to the original cell and I have to move over to where it should have moved. Is there some way I can make the macro move the cursor correctly? Sub Macro1() With Selection.Borders(xlEdgeLeft) .LineStyle = xlContinuous .Weight = xlThin .ColorIndex = xlAutomatic End With ActiveCell()(1, 4).Select End Sub This will add the border to the current active or selected cell. --...

I have an append query that I want to run several times
I have an append query that I want to run until there are not more records to append. Any idea how can I write a procedure or a macro. I used the RunMacro command but the exprression is not correct; please help me. this is the expression in the RunMacro command, DCount("*","Ste2-Append Weeks in Capacity Data")=0. Ste2-Append Weeks in Capacity Data this is the name of my append query. Thanks a lot In Access, it all starts with the data. If you'll describe your data (both the data structure you want to append to and what you are appending from) a bit more specifica...

Running headings in Publisher
I am producing a journal with about 15 articles, between 2 and 5 pages long. I need running heading to change with each. Do I have to duplicate master pages for each or is there an easier way. ...

Visual C++ Run Time error when opening Outlook 2000
I get the following error message when opening Outlook 2000 on a Win98 machine: Runtime Error! Program: C:\Programs\Microsoft Office\Office\Outlook.exe This program has requested the runtime to terminate it in an unusual way. I have uninstalled/reinstalled Office2000. I have downloaded newest updates to Office 2000. I have run a virus check on the PC. I turned off the anti-virus software. I have run the repair utility - all without success. I suspect a problem in the registry, but don't know what to look for. Has anyone come across this problem? Can someone help? I would be eve...

Log users out automatically
Is there a way to automatically log users out of their exchange account at a certain time? Without logging out of Windows? I've got 2-3 users that refuse to log off exchange when they leave each night which causes incomplete backups. Thanks for any help! In news:74C89A9A-4350-4375-BDEE-49747CDD841A@microsoft.com, Victor <Victor@discussions.microsoft.com> typed: > Is there a way to automatically log users out of their exchange > account at a certain time? Without logging out of Windows? I've got > 2-3 users that refuse to log off exchange when they leave each n...

Automatically show new date in the modified cell
I like to add today's date next to the cell value. Everytime the cell is modified, I want the date to be updated automatically to today's date. Any help is appreciated. NYBoy -- NYBoy ------------------------------------------------------------------------ NYBoy's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=8360 View this thread: http://www.excelforum.com/showthread.php?threadid=472219 have a look at http://www.mcgimpsey.com/excel/timestamp.htm -- bill ----------------------------------------------------------------------- bill k's Prof...

Naming Sheets in a Macro
I've run accross a problem many times in Excel where I'm running a macro that creates new sheets - Sheet1, Sheet2, Sheet3 and I rename these sheets in the macro using the following code: Sheets("Sheet3").Select Sheets("Sheet3").Name = Range("A2") It would be helpful not to have refer to new sheets as ("Sheet1","Shhet2" ect) that i'm in when naming them though as it means that i have to shut down excel and reopen it every time i want to run the macro otherwise it will break (since the only time the sheets start back at 1 is w...

running a script as a scheduled task error
I am trying to run a batch file in a scheduled task that runs a script (.ps1) that adds and removes child objects from a PG. if I run this batch file manually the script runs and the child object is either added or removed. great! if the batch file runs as a scheduled task I get this error: WARNING: The following errors occurred when loading console C:\Program Files\Microsoft Data Protection Manager\DPM\bin\dpmshell.psc1: Cannot load Windows PowerShell snap-in MSDPM because of the following error: No Windows PowerShell Snap-ins are available for version 1. Command "....

Running two sessions of Outlook...
Is it possible, at all to run two sessions of Outlook 2003, on the same pc, at the same time? I know I can create profiles (one for work, and the other for personal). But, I need to keep works profile opened 24/7, but still want to check personal from time to time... Thanks in advance No, you can't have two profiles open simultaneously. Could you add both accounts to the same profile and manage it with rules or something? "Ivan T Williams" <itw@discussions.com> wrote in message news:exO6IdAMHHA.2028@TK2MSFTNGP03.phx.gbl... > Is it possible, at all to run two...

macro within a macro
I want to have a macro which looks at the results in a particular cell. If the cell says "yes", then the macro should select a specific named range in the worksheet and print it. But if the answer is "no" or the cell is blank, then a different named range should be selected and printed. I tried setting up two print macros - 1 for each range. I then wanted to have a macro button that executed an if statement to select which range to print, but couldn't make this operable. Does anyone have a way to accomplish this selected area printing- either with or with...

Using macro or something instead of formula
I am working on a workbook which contain 2 sheet It would be easier if someone look at the excel file basically i want to replace all the formula with vlookup with something else.. this is due to the fact that the orginal file contain over 5000 of the same formula which made the file size very big. which is not really suitable. Attachment filename: help.xls Download attachment: http://www.excelforum.com/attachment.php?postid=408218 --- Message posted from http://www.ExcelForum.com/ ...

Excel BUG in macro recording (every version)
I have found a bug in every Excel version, where can i post it? 1) Start recording a new Macro 2) Go to Print Preview 3) Adjust a margin 4) Stop recording The macro contains errors because it has empty parameters for the margins: With ActiveSheet.PageSetup .LeftMargin = Application.InchesToPoints(0.84) .RightMargin = Application.InchesToPoints() .TopMargin = Application.InchesToPoints() .BottomMargin = Application.InchesToPoints() .HeaderMargin = Application.InchesToPoints() .FooterMargin = Application.InchesToPoints() w From XL2003 ..L...

The services for exchange server stop automatically---Urgently
We use SBS2003, but today the services for email system, such as POP3, SMTP stop automatically. Even I restart these services, 2 mins later the services stop again. But I check the Event View, and could not find any error message. Does someone here help me to fix this issue? On Thu, 30 Nov 2006 23:18:00 -0800, Michael Tang <MichaelTang@discussions.microsoft.com> wrote: >We use SBS2003, but today the services for email system, such as POP3, SMTP >stop automatically. Even I restart these services, 2 mins later the services >stop again. But I check the Event View, and could ...

Macros setup deployment
Hi! I have a Template (to place in the template folder) and a .xls file with macros (to place in the XLStart folder) to deploy. Is it possible to deploy thoses files with a setup.bat? The difficuly is to get the template and the XLStart folders in a command line. If it's not possible, which are the other ways to automatically install those files? Thanks for help, Thierry Paradis. Hi Thierry, See Jan Karel Pieterse's create an Addin tutorial which also includes a set-up utilty: http://www.jkp-ads.com/Articles/DistributeMacro00.htm --- Regards, Norman "Thierr...

Macro Security on 97
I have a client who is running Excel 97. My spreadsheet contains macros, and they cannot open the file. My guess is their security is set too high. Where is the security setting on '97? My other guess is '97 cannot recognize '02 or '00 files?? Does anyone have a solution, or know what the problem might be? The file formats for xl97 through xl2002 is the same, so that's not it. If it were the macro security too high, then they should still be able to open the workbook. But they won't be able to run the macros. If you emailed the workbook to them, you may w...

How do I send monthly automatic e-mails
I want to send out a monthly reminder letter to a group of people automatically on a given day each month. Can I do this in Outlook? "srburguy" <srburguy@discussions.microsoft.com> wrote in message news:F4517E50-E377-4E74-9ECD-22AA9ACF3AE9@microsoft.com... >I want to send out a monthly reminder letter to a group of people > automatically on a given day each month. Can I do this in Outlook? See this: http://www.slipstick.com/mail1/recurringmail.asp -- Brian Tillman [MVP-Outlook] ...