PC Review


Reply
Thread Tools Rate Thread

AutoRun Macro

 
 
jee22
Guest
Posts: n/a
 
      29th Jul 2004
Can some one tell me how to run a macro as soon as the sheet is opened. I
have a box which needs to be filled using Add.item when the sheet opens.

The Additem routine works correctly when I click the button for it, but I
want to dispense with the button.

Thank you in advance.


--
(E-Mail Removed)
Materials Science & Metallurgy
Ext 34346


 
Reply With Quote
 
 
 
 
Frank Kabel
Guest
Posts: n/a
 
      29th Jul 2004
Hi
you can use a workbook event for this.
If you mean the file openening use the workbook_open event

>-----Original Message-----
>Can some one tell me how to run a macro as soon as the

sheet is opened. I
>have a box which needs to be filled using Add.item when

the sheet opens.
>
>The Additem routine works correctly when I click the

button for it, but I
>want to dispense with the button.
>
>Thank you in advance.
>
>
>--
>(E-Mail Removed)
>Materials Science & Metallurgy
>Ext 34346
>
>
>.
>

 
Reply With Quote
 
jee22
Guest
Posts: n/a
 
      29th Jul 2004
Not quiet Frank. I have a list box on the sheet which has a button next to
it
the button activates a macro to fill the list box with data.

What I want to do is for the macro to run when I open the sheet, thus
negating the need for the button

regards
J
"Frank Kabel" <(E-Mail Removed)> wrote in message
news:65e101c47564$0e43f2d0$(E-Mail Removed)...
> Hi
> you can use a workbook event for this.
> If you mean the file openening use the workbook_open event
>
> >-----Original Message-----
> >Can some one tell me how to run a macro as soon as the

> sheet is opened. I
> >have a box which needs to be filled using Add.item when

> the sheet opens.
> >
> >The Additem routine works correctly when I click the

> button for it, but I
> >want to dispense with the button.
> >
> >Thank you in advance.
> >
> >
> >--
> >(E-Mail Removed)
> >Materials Science & Metallurgy
> >Ext 34346
> >
> >
> >.
> >



 
Reply With Quote
 
Frank Kabel
Guest
Posts: n/a
 
      29th Jul 2004
Hi
then use the Worksheet_Activate event of your worksheet

>-----Original Message-----
>Not quiet Frank. I have a list box on the sheet which has

a button next to
>it
>the button activates a macro to fill the list box with

data.
>
>What I want to do is for the macro to run when I open the

sheet, thus
>negating the need for the button
>
>regards
>J
>"Frank Kabel" <(E-Mail Removed)> wrote in message
>news:65e101c47564$0e43f2d0$(E-Mail Removed)...
>> Hi
>> you can use a workbook event for this.
>> If you mean the file openening use the workbook_open

event
>>
>> >-----Original Message-----
>> >Can some one tell me how to run a macro as soon as the

>> sheet is opened. I
>> >have a box which needs to be filled using Add.item when

>> the sheet opens.
>> >
>> >The Additem routine works correctly when I click the

>> button for it, but I
>> >want to dispense with the button.
>> >
>> >Thank you in advance.
>> >
>> >
>> >--
>> >(E-Mail Removed)
>> >Materials Science & Metallurgy
>> >Ext 34346
>> >
>> >
>> >.
>> >

>
>
>.
>

 
Reply With Quote
 
jee22
Guest
Posts: n/a
 
      29th Jul 2004
Thanks for your time Frank, I tried that and it did not work
Regards

J
"Frank Kabel" <(E-Mail Removed)> wrote in message
news:695c01c47575$c821d3a0$(E-Mail Removed)...
> Hi
> then use the Worksheet_Activate event of your worksheet
>
> >-----Original Message-----
> >Not quiet Frank. I have a list box on the sheet which has

> a button next to
> >it
> >the button activates a macro to fill the list box with

> data.
> >
> >What I want to do is for the macro to run when I open the

> sheet, thus
> >negating the need for the button
> >
> >regards
> >J
> >"Frank Kabel" <(E-Mail Removed)> wrote in message
> >news:65e101c47564$0e43f2d0$(E-Mail Removed)...
> >> Hi
> >> you can use a workbook event for this.
> >> If you mean the file openening use the workbook_open

> event
> >>
> >> >-----Original Message-----
> >> >Can some one tell me how to run a macro as soon as the
> >> sheet is opened. I
> >> >have a box which needs to be filled using Add.item when
> >> the sheet opens.
> >> >
> >> >The Additem routine works correctly when I click the
> >> button for it, but I
> >> >want to dispense with the button.
> >> >
> >> >Thank you in advance.
> >> >
> >> >
> >> >--
> >> >(E-Mail Removed)
> >> >Materials Science & Metallurgy
> >> >Ext 34346
> >> >
> >> >
> >> >.
> >> >

> >
> >
> >.
> >



 
Reply With Quote
 
Frank Kabel
Guest
Posts: n/a
 
      29th Jul 2004
Hi
what exactly didn't work for you?

>-----Original Message-----
>Thanks for your time Frank, I tried that and it did not

work
>Regards
>
>J
>"Frank Kabel" <(E-Mail Removed)> wrote in message
>news:695c01c47575$c821d3a0$(E-Mail Removed)...
>> Hi
>> then use the Worksheet_Activate event of your worksheet
>>
>> >-----Original Message-----
>> >Not quiet Frank. I have a list box on the sheet which

has
>> a button next to
>> >it
>> >the button activates a macro to fill the list box with

>> data.
>> >
>> >What I want to do is for the macro to run when I open

the
>> sheet, thus
>> >negating the need for the button
>> >
>> >regards
>> >J
>> >"Frank Kabel" <(E-Mail Removed)> wrote in message
>> >news:65e101c47564$0e43f2d0$(E-Mail Removed)...
>> >> Hi
>> >> you can use a workbook event for this.
>> >> If you mean the file openening use the workbook_open

>> event
>> >>
>> >> >-----Original Message-----
>> >> >Can some one tell me how to run a macro as soon as

the
>> >> sheet is opened. I
>> >> >have a box which needs to be filled using Add.item

when
>> >> the sheet opens.
>> >> >
>> >> >The Additem routine works correctly when I click the
>> >> button for it, but I
>> >> >want to dispense with the button.
>> >> >
>> >> >Thank you in advance.
>> >> >
>> >> >
>> >> >--
>> >> >(E-Mail Removed)
>> >> >Materials Science & Metallurgy
>> >> >Ext 34346
>> >> >
>> >> >
>> >> >.
>> >> >
>> >
>> >
>> >.
>> >

>
>
>.
>

 
Reply With Quote
 
Dave Peterson
Guest
Posts: n/a
 
      29th Jul 2004
Did you select another sheet in the same workbook, then come back to the sheet
with the listbox?

If yes, did you put the worksheet_activate code behind the worksheet that held
the listbox.

jee22 wrote:
>
> Thanks for your time Frank, I tried that and it did not work
> Regards
>
> J
> "Frank Kabel" <(E-Mail Removed)> wrote in message
> news:695c01c47575$c821d3a0$(E-Mail Removed)...
> > Hi
> > then use the Worksheet_Activate event of your worksheet
> >
> > >-----Original Message-----
> > >Not quiet Frank. I have a list box on the sheet which has

> > a button next to
> > >it
> > >the button activates a macro to fill the list box with

> > data.
> > >
> > >What I want to do is for the macro to run when I open the

> > sheet, thus
> > >negating the need for the button
> > >
> > >regards
> > >J
> > >"Frank Kabel" <(E-Mail Removed)> wrote in message
> > >news:65e101c47564$0e43f2d0$(E-Mail Removed)...
> > >> Hi
> > >> you can use a workbook event for this.
> > >> If you mean the file openening use the workbook_open

> > event
> > >>
> > >> >-----Original Message-----
> > >> >Can some one tell me how to run a macro as soon as the
> > >> sheet is opened. I
> > >> >have a box which needs to be filled using Add.item when
> > >> the sheet opens.
> > >> >
> > >> >The Additem routine works correctly when I click the
> > >> button for it, but I
> > >> >want to dispense with the button.
> > >> >
> > >> >Thank you in advance.
> > >> >
> > >> >
> > >> >--
> > >> >(E-Mail Removed)
> > >> >Materials Science & Metallurgy
> > >> >Ext 34346
> > >> >
> > >> >
> > >> >.
> > >> >
> > >
> > >
> > >.
> > >


--

Dave Peterson
(E-Mail Removed)
 
Reply With Quote
 
jee22
Guest
Posts: n/a
 
      30th Jul 2004
The box did not fill with the data when I opened the sheet. I am using
office 2000 on win2000
Thanks
J
"Frank Kabel" <(E-Mail Removed)> wrote in message
news:67b601c4757a$244b96d0$(E-Mail Removed)...
> Hi
> what exactly didn't work for you?
>
> >-----Original Message-----
> >Thanks for your time Frank, I tried that and it did not

> work
> >Regards
> >
> >J
> >"Frank Kabel" <(E-Mail Removed)> wrote in message
> >news:695c01c47575$c821d3a0$(E-Mail Removed)...
> >> Hi
> >> then use the Worksheet_Activate event of your worksheet
> >>
> >> >-----Original Message-----
> >> >Not quiet Frank. I have a list box on the sheet which

> has
> >> a button next to
> >> >it
> >> >the button activates a macro to fill the list box with
> >> data.
> >> >
> >> >What I want to do is for the macro to run when I open

> the
> >> sheet, thus
> >> >negating the need for the button
> >> >
> >> >regards
> >> >J
> >> >"Frank Kabel" <(E-Mail Removed)> wrote in message
> >> >news:65e101c47564$0e43f2d0$(E-Mail Removed)...
> >> >> Hi
> >> >> you can use a workbook event for this.
> >> >> If you mean the file openening use the workbook_open
> >> event
> >> >>
> >> >> >-----Original Message-----
> >> >> >Can some one tell me how to run a macro as soon as

> the
> >> >> sheet is opened. I
> >> >> >have a box which needs to be filled using Add.item

> when
> >> >> the sheet opens.
> >> >> >
> >> >> >The Additem routine works correctly when I click the
> >> >> button for it, but I
> >> >> >want to dispense with the button.
> >> >> >
> >> >> >Thank you in advance.
> >> >> >
> >> >> >
> >> >> >--
> >> >> >(E-Mail Removed)
> >> >> >Materials Science & Metallurgy
> >> >> >Ext 34346
> >> >> >
> >> >> >
> >> >> >.
> >> >> >
> >> >
> >> >
> >> >.
> >> >

> >
> >
> >.
> >



 
Reply With Quote
 
jee22
Guest
Posts: n/a
 
      30th Jul 2004
Dave
There is only one sheet in this work book. The code is applied to that sheet
in the VBA panel
Thanks

"Dave Peterson" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Did you select another sheet in the same workbook, then come back to the

sheet
> with the listbox?
>
> If yes, did you put the worksheet_activate code behind the worksheet that

held
> the listbox.
>
> jee22 wrote:
> >
> > Thanks for your time Frank, I tried that and it did not work
> > Regards
> >
> > J
> > "Frank Kabel" <(E-Mail Removed)> wrote in message
> > news:695c01c47575$c821d3a0$(E-Mail Removed)...
> > > Hi
> > > then use the Worksheet_Activate event of your worksheet
> > >
> > > >-----Original Message-----
> > > >Not quiet Frank. I have a list box on the sheet which has
> > > a button next to
> > > >it
> > > >the button activates a macro to fill the list box with
> > > data.
> > > >
> > > >What I want to do is for the macro to run when I open the
> > > sheet, thus
> > > >negating the need for the button
> > > >
> > > >regards
> > > >J
> > > >"Frank Kabel" <(E-Mail Removed)> wrote in message
> > > >news:65e101c47564$0e43f2d0$(E-Mail Removed)...
> > > >> Hi
> > > >> you can use a workbook event for this.
> > > >> If you mean the file openening use the workbook_open
> > > event
> > > >>
> > > >> >-----Original Message-----
> > > >> >Can some one tell me how to run a macro as soon as the
> > > >> sheet is opened. I
> > > >> >have a box which needs to be filled using Add.item when
> > > >> the sheet opens.
> > > >> >
> > > >> >The Additem routine works correctly when I click the
> > > >> button for it, but I
> > > >> >want to dispense with the button.
> > > >> >
> > > >> >Thank you in advance.
> > > >> >
> > > >> >
> > > >> >--
> > > >> >(E-Mail Removed)
> > > >> >Materials Science & Metallurgy
> > > >> >Ext 34346
> > > >> >
> > > >> >
> > > >> >.
> > > >> >
> > > >
> > > >
> > > >.
> > > >

>
> --
>
> Dave Peterson
> (E-Mail Removed)



 
Reply With Quote
 
jee22
Guest
Posts: n/a
 
      30th Jul 2004
Dave and Frank

I opened a new work book and entered just this code in Private Sub
Worksheet_Activate()
Dim n, p, q
Sheet1.lb1.Clear
Sheet1.lb2.Clear
Sheet1.lb3.Clear
For n = 1 To 12 Step 0.25
Sheet1.lb1.AddItem (n * 25.4)
Sheet1.lb2.AddItem (n * 25.4)
Next
For n = 6 To 25 Step 0.5
Sheet1.lb3.AddItem (n)
next

I then saved it and the sheet and closed the sheet.

Opening the sheet I briefly saw the data fill the boxes fill with data and
then blank. So it is working but the data is not visible. A slightly
different slant on the problem.
Can either of you wizards help?

Thanks


"jee22" <(E-Mail Removed)> wrote in message
news:ceajhq$f4r$(E-Mail Removed)...
> Can some one tell me how to run a macro as soon as the sheet is opened. I
> have a box which needs to be filled using Add.item when the sheet opens.
>
> The Additem routine works correctly when I click the button for it, but I
> want to dispense with the button.
>
> Thank you in advance.
>
>
> --
> (E-Mail Removed)
> Materials Science & Metallurgy
> Ext 34346
>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
AutoRun Macro with a delay to give user the choice to cancel the macro wanderlust Microsoft Excel Programming 3 20th Oct 2011 09:01 PM
Autorun macro =?Utf-8?B?S2VsbHk=?= Microsoft Excel Worksheet Functions 1 18th Jan 2006 04:03 PM
Autorun a macro Paul Wisken Microsoft Excel Programming 6 7th Sep 2005 09:02 AM
Excel Macro Issue Trying to autorun Macro Upon Opening Worksheet wyndman Microsoft Excel Programming 2 25th May 2004 06:59 PM
Re: HELP!!! SOS!!! Autorun macro? Shyam Pillai Microsoft Powerpoint 0 12th Dec 2003 01:41 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:49 AM.