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
2297 Views

Similar Articles

[PageSpeed] 10

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:

Macro on cell content
Dear all, this must be a common problem, and I thought I found the solution, but it doesn't work ... I'm probably missing something very simple. I want to execute a simple VB function in one cell, taking another cell as Parameter. Both, parameter cell and function result are strings. For example: A1: "this is content of cell A1" A2: =Convert(A1) and Convert is a VB function Function Convert(content As string) as String ' do something depending on content Convert = "result-string" End Function However, I always get a #NAME? Error in cell A2. The ide...

Message automatically deleted after opening
I am using Windows Mail in Vista 32 bit Home Premium. Recently I have been encountering a problem with my e-mails. I open an e-mail and close it after it is read. If I proceed to go to another folder and, then return to the Inbox, the message that I read is no longer there. It doesn't go to the Delete Folder or, any other folder that I have set up. Does anyone know why this is happening and, how I can fix it. Thanks. -- Floridaguy "Floridaguy" <Floridaguy@discussions.microsoft.com> wrote in message news:53C48531-DCA8-45BE-8C65-97B19E28B977@microsoft.c...

using macro to save a file produces runtime error 4198
I upgraded from Win-XP/Office 2003 to Win-7/Office 2007; the code below ran fine in Word 2003 but in Word 2007 generates runtime error 4198. The variables and directory location are valid. The parameters for FileName are updated for Word 2007; the grammer for the FileName appears correct (no grammer errors when macro runs as is, but grammer errors if I change the string.) When I substitute an actual file name in place of the variables, the code runs w/o error, but the Debug.Print statements generate correct strings. I feel kind of dumb- but what is different about use of variab...

Automatic Send/Receive When Closed
I have Outlook 2002 and it used to send and recieve when I was not in the program itself. It was actually kind of handy. A little mail icon would show up in the system try to let me know email was there. It was great when I was doing other work. It was also good becuase when I am at the office, I can download my email when I sync my mobile device with my computer. How do I get that back? Any ideas? ...

Trying begin VBA template project, get error "macros disabled"?
I am beginning a project to code and update a Word template using VBA. When I try to run the form given to me I get error "The macros in this project are disabled?" Any suggestions? Thank you. Save the template in your templates folder, which is a trusted location. -- Hope this helps. Please reply to the newsgroup unless you wish to avail yourself of my services on a paid consulting basis. Doug Robbins - Word MVP, originally posted via msnews.microsoft.com "The Applicant" <The Applicant@discussions.microsoft.com> wrote in message news:D2E642C...

How to make a 'automatic mail rule installer'
Hi, I wrote a mail rule and want to distribute it to my friends. but I think it will be nicer if the mail rule can be installed with just one click. How can I make it? If 'visual script' is an answer, which object shoud I create? Or Where can I find the reference or sample? I'll be very appreciate if you give me just a hint. More explanation on my question. Maybe the expression 'wrote' in "I wrote a mail rule" is distracting. 'mail rule' means the rule which can be made through the menu 'tools' , which is usually used for filtering, forwar...

Money 2005
Option to start statement download when the program starts does not work. I have to manually click the circle with the arrows button. What is wrong with the setup? I think this may be a WinXP issue... I was using Money 2005 with Win98SE and automatic updates worked (or at least happened) but recently upgraded to WinXP SP2 and now I too have to manually click the "Update Now" option... I have also noticed that some settings do not get saved between Money sessions... for example, the Update Status Dialog that has the "Hide this window during update" checkbox... well...

editing cells automatically???
Why is it that some spreadsheets will not allow you to edit cells automatically when tabbing between windows? i.e. some spreadsheets will require you to double click in the cell to continue editing once you navigate away from that spreadsheet. Not too clear on your problem but............ Is it possible you have separate instances of Excel running with different editing options? Gord Dibben MS Excel MVP On Thu, 13 May 2010 14:25:01 -0700, yogiiyogee <yogiiyogee@discussions.microsoft.com> wrote: >Why is it that some spreadsheets will not allow you to edit cell...

Copy/Paste macro...with a few twists
Hi, I needed to create a macro that would copy/paste all the selected rows into a new workbook which the macro creates. Before creating the workbook however I need it to ask the user for a six digit number, which it then takes and names the workbook (eg. PO######) and attaches the current date on the end. I'm still a newb to VBA so any help is appreciated. Best Regards, Mjack003 --- Message posted from http://www.ExcelForum.com/ Something like this might get you started: Option Explicit Sub testme() Dim myStr As String Dim newWkbk As Workbook Do myStr = ...

Macro to delete specific data in tables
Hi: I am an analyst working in service quality for a market research firm. We use SPSS 12 to output the data and later copy paste the tables into Excel for formatting and printing. The problem I currently have is that I got a large group of output tables which come in two different formats. The first table is like this: Satisfacción Expectativas Mean Std Deviation Masculino 5,4 1,4 Femenino 3,8 2,2 Group Total 5,3 1,5 Menos de 2400 UF 5,9 ,9 2401 a 25 mil UF 5,6 1,2 25.001 a 100 mil UF 5,0 1,6 Más de 100.001 UF ...

schedule a task to run a report
I need to use the Windows task scheduler to run a report, I can see how to do this if the access file is closed. What if the file is currently open ? regards Trevor -- Message posted via AccessMonster.com http://www.accessmonster.com/Uwe/Forums.aspx/access-gettingstarted/200911/1 Hi Trevor, use a different database for the scheduler task ... link to all your tables, put your report in there and anything else it needs create an AutoExec macro that opens the report (which will automatically print unless you specify otherwise) and then exits Access Warm Regards, ...

Macro Blunder
I seem to have lost the toolbar that pops up when you prompt Excel t create a new macro. The toolbar with the stop button and the relative reference button i gone. How do I get it back??? Thanks ----------------------------------------------- ~~ Message posted from http://www.ExcelTip.com ~~View and post usenet messages directly from http://www.ExcelForum.com nkob Tools>Customize>Toolbars. Select "Stop Recording" toolbar>Close Stop Recording Toolbar should now be visible on sheet. Hit "X" to close it(but not while you are recording). It will pop up next ...

when re-running installer to install omitted program (Entourage) does complete re-install, then fails
Version: 2008 Operating System: Mac OS X 10.5 (Leopard) Processor: intel Hi Everyone. I installed Word and PowerPoint a few weeks ago, and I want to now install Entourage. So I re-ran the installer ("/Volumes/Microsoft Office 2008/Office Installer.mpkg"). It didn't give me any options for selecting Entourage. Instead it just kicked off an installed *everything*, including Word and PowerPoint. Crap. This is very upsetting as I DON'T want messenger, excel, etc. Adding insult to injury, the program asked if I wanted to install the update ("Install Microsoft Office 2008 fo...

Activity Appointment Closed automatic
When I have an activity that is an appointment, it seems that there is an automatic mechanism that closes the activity next Day. So, users cannot change anything on that activity. All fields are disabled as it must be on a closed activity. But usually users, want to comment their appointments the next day they saw up at office. The only thing they can do is to add Notes, but this is not what they actually want to do. Is there any way to find and change the funtion that closes activities that are appointments next day after the scheduled time ? Regards Elias Kitsopoulos Login Ltd Software De...

Incident should be create automatically like c360 products
With any parameters or config, Incidents should be created automatically like EmailToCase c360 product. Thanks! ---------------- This post is a suggestion for Microsoft, and Microsoft responds to the suggestions with the most votes. To vote for this suggestion, click the "I Agree" button in the message pane. If you do not see the button, follow this link to open the suggestion in the Microsoft Web-based Newsreader and then click "I Agree" in the message pane. http://www.microsoft.com/Businesssolutions/Community/NewsGroups/dgbrowser/en-us/default.mspx?mid=7b9224b9-28b...

Automatic refresh grid
When our support people are trying to monitor queues it is not very practical to expect them to continue pressing the refresh button every few minutes. Is there any method to automatically refresh the grid? Any help would be greatly appricated This is not supported way. http://localhost/workplace/home_workplace.aspx if you look at the code in that page and the code below you will see the line of code used to force the page to refresh eveyr 5 seconds. Note that modifying pages like this is unsupported. Inherits="Microsoft.Crm.Web.Workplace.HomeWorkplacePage" CodeBehind="M...

Open Form with macro and data from Selected Record
I am wanting a person to open a form, and have the subform display the records that relate to the main form. This part works. I then have a continuous form view for the subform and i want the user to be able to double click on the record they see in the subform and have it pull up that record into a blank form. I get the blank form to open up when they double click, however I cannot get the data for that record to show up. I either get a blank/new record or all records. I am trying the SearchForRecord macro in an On Load Event. This loads after the form has been opened. Ac...

numbering macro
In a database of say 10 columns and 100 rows, how do I record a macro that will o Insert a new column to the left of column A, then o in the new column A, number the rows that contain data in column B. Note: The numbering should start from 1. Since row 1 has the database heading & row 2 has the column headings, the numbering (no. 1) should start from row 3 and continue down to the last row that has data in column B. Columns("A:A").Insert For i = 1 to 100 If Cells(i,"B").Value <> "" Then Cells(i,"A&q...

Field name derived from a string value returns a Run-time error 2465.
I have two labels on a form and want to populate them during the run time of my form. The name of the labels are "1" the other is called "2" (without the quotes of course). Field 1 runs OK but two returns a run-time error 2465. Of course, the real form is much bigger. A lot of fields called 1 through 31 are populated from within a loop. To simplify my question I down sized this post to two label fields. Any one know how to solve the problem with label "2"? Any help or hint is appreciated. ' This works OK Me![1].Caption = "abc"...

Outlook Macro
I need to set a large number of Outlook calendar entires to: Show Time as: Free, and Sensitivity: Private I am having difficulty working out how to write a macro to do this. can anyone help please? Thanks V ...

32-bit cd how to run on 64-bit computer
I just bought a new computer and my 32-bit cd's won't work. Is there a program out there that will convert them so they are able to run on the 64-bit computer? On 24/02/2010 in message <056ECF1B-0A9F-494E-9265-9F48092E1A97@microsoft.com> paulabelle wrote: >I just bought a new computer and my 32-bit cd's won't work. Is there a >program out there that will convert them so they are able to run on the >64-bit computer? No, the programs would need to be re-written/re-compiled. There is no reason why 32 bit programs shouldn't run on Windows 64 - ...

Automatic updates of a ranked table
I want to take data from one spreadsheet to make a ranked table (soccer league). Is it possible to design it so that the league will automatically update (and re-rank the teams and the data) when I enter new data in the spreadsheet? -- Spobber ------------------------------------------------------------------------ Spobber's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=19966 View this thread: http://www.excelforum.com/showthread.php?threadid=345736 ...

Balance column in statements NEEDS to be a running balance!
We are using RMS Store Operations and have been haunted by the statement that comes standard with the software. Customers that really read their statements are completely dissatisfied with the way the balance column computes. Some customers have gone as far as refusing to pay off of them with out us re-printing their invoices and penciling in the correct amounts to prove the final balance... NO GOOD! The statement that I am referring to only occurs when we are using a revolving account type and the Radio Button for "Due after invoice date plus" is checked, we set ours for ...

Cell Formatting with a macro...
Related to a previous topic. I have a worksheet that uses conditional formatting. However, I need to add a 4th condition. I need to code a macro that checks the content of a cell, and then changes the formating (color) of a range of cells if the condition is met. For example if cell M1 is populated with an 'X', then I want excel to change the color of the cells (pattern) for the range A1:M1. Basically, the macro will check for values in the M column and highlight all the cells in the intersecting row. I used conditional formating to perform other tasks, but since Excel only supp...

How can setup the receipt format automatical reprint for a seriali
How can edit the (.xml) receipt format to automatic reprint for a serialize item in the transation? This would be great for rebates with serialized items. ...