close

I have created a macro in the visual basic editor of my excel file, but I
don't know how to auto activate the macro whenever this file is opened or
when quot;Shiftquot; amp;quot;:quot; buttons are pressed. Can someone teach me how to make this
happen.
Thank you.

Bonzio

If you want the macro to run only when the file is opened, you can put the
code in a Workbook_Open event macro.
You can accomplish the same thing by putting the macro in a regular module
and naming the macro Auto_Open.
However, if you want the macro to run when the file is opened AND also when
you press a key combination, then you need the above Auto_Open macro in a
regular module.
To make the macro run from a key combination, go back to your
spreadsheet on the screen. Click on Tools - Macro - Macros and you will see
a list of all macros in all open workbooks. Select This Workbook to see
only those macros in the active workbook. Find the Auto_Open macro. Click
once on that macro, then click on Options. There you will see quot;Ctrlquot; and a
blank box. Hold down the Shift key and press the letter key of your choice,
say K. Now when you hold down both the Ctrl and Shift keys and press K, the
macro will run.
Please post back if you need more. HTH Otto
quot;bonzioquot; gt; wrote in message
...
gt;I have created a macro in the visual basic editor of my excel file, but I
gt; don't know how to auto activate the macro whenever this file is opened or
gt; when quot;Shiftquot; amp;quot;:quot; buttons are pressed. Can someone teach me how to make
gt; this
gt; happen.
gt; Thank you.
gt;
gt; Bonzio
Thank you for your info, and now I have accomplished what I wanted for my
programming file.

Bonzio

quot;Otto Moehrbachquot; wrote:

gt; If you want the macro to run only when the file is opened, you can put the
gt; code in a Workbook_Open event macro.
gt; You can accomplish the same thing by putting the macro in a regular module
gt; and naming the macro Auto_Open.
gt; However, if you want the macro to run when the file is opened AND also when
gt; you press a key combination, then you need the above Auto_Open macro in a
gt; regular module.
gt; To make the macro run from a key combination, go back to your
gt; spreadsheet on the screen. Click on Tools - Macro - Macros and you will see
gt; a list of all macros in all open workbooks. Select This Workbook to see
gt; only those macros in the active workbook. Find the Auto_Open macro. Click
gt; once on that macro, then click on Options. There you will see quot;Ctrlquot; and a
gt; blank box. Hold down the Shift key and press the letter key of your choice,
gt; say K. Now when you hold down both the Ctrl and Shift keys and press K, the
gt; macro will run.
gt; Please post back if you need more. HTH Otto
gt; quot;bonzioquot; gt; wrote in message
gt; ...
gt; gt;I have created a macro in the visual basic editor of my excel file, but I
gt; gt; don't know how to auto activate the macro whenever this file is opened or
gt; gt; when quot;Shiftquot; amp;quot;:quot; buttons are pressed. Can someone teach me how to make
gt; gt; this
gt; gt; happen.
gt; gt; Thank you.
gt; gt;
gt; gt; Bonzio
gt;
gt;
gt;

You're welcome and thanks for the feedback. Otto
quot;bonzioquot; gt; wrote in message
...
gt; Thank you for your info, and now I have accomplished what I wanted for my
gt; programming file.
gt;
gt; Bonzio
gt;
gt; quot;Otto Moehrbachquot; wrote:
gt;
gt;gt; If you want the macro to run only when the file is opened, you can put
gt;gt; the
gt;gt; code in a Workbook_Open event macro.
gt;gt; You can accomplish the same thing by putting the macro in a regular
gt;gt; module
gt;gt; and naming the macro Auto_Open.
gt;gt; However, if you want the macro to run when the file is opened AND also
gt;gt; when
gt;gt; you press a key combination, then you need the above Auto_Open macro in a
gt;gt; regular module.
gt;gt; To make the macro run from a key combination, go back to your
gt;gt; spreadsheet on the screen. Click on Tools - Macro - Macros and you will
gt;gt; see
gt;gt; a list of all macros in all open workbooks. Select This Workbook to see
gt;gt; only those macros in the active workbook. Find the Auto_Open macro.
gt;gt; Click
gt;gt; once on that macro, then click on Options. There you will see quot;Ctrlquot; and
gt;gt; a
gt;gt; blank box. Hold down the Shift key and press the letter key of your
gt;gt; choice,
gt;gt; say K. Now when you hold down both the Ctrl and Shift keys and press K,
gt;gt; the
gt;gt; macro will run.
gt;gt; Please post back if you need more. HTH Otto
gt;gt; quot;bonzioquot; gt; wrote in message
gt;gt; ...
gt;gt; gt;I have created a macro in the visual basic editor of my excel file, but
gt;gt; gt;I
gt;gt; gt; don't know how to auto activate the macro whenever this file is opened
gt;gt; gt; or
gt;gt; gt; when quot;Shiftquot; amp;quot;:quot; buttons are pressed. Can someone teach me how to
gt;gt; gt; make
gt;gt; gt; this
gt;gt; gt; happen.
gt;gt; gt; Thank you.
gt;gt; gt;
gt;gt; gt; Bonzio
gt;gt;
gt;gt;
gt;gt;

arrow
arrow
    全站熱搜
    創作者介紹
    創作者 software 的頭像
    software

    software

    software 發表在 痞客邦 留言(0) 人氣()