Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 26
Default Private Sub() - Sub()

Hi,
I know only "record macro" way, then I edit that recorded macro.
And I see that they always start Sub()

I sometimes see in your solutions
macros starting as "Private Sub..."
How do we run such macros ?

Thanks,

Cousin Excel
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 905
Default Private Sub() - Sub()

"CousinExcel" wrote:
I sometimes see in your solutions
macros starting as "Private Sub..."
How do we run such macros ?


Usually, such subroutines (and functions) are not intended to be executed
directly. They might be routines that support public routines, i.e. routines
that __are__ intended to executed directly.

But you can always go into VBA (press alt+F11), select the macro, and press
F5. You should not do that unless you know that the macro is intended to be
executed in that way.

I posted a Private Sub by mistake recently. I had intended to remove the
word Private.

Sometimes I have multiple experimental macros in different modules. Lacking
imagination, I might call all of them doit(). So I use the Private feature
to ensure that VBA does not get confused and raise an error. I don't need to
execute them from Excel because I am doing all my work in VBA.


----- original message -----

"CousinExcel" wrote:
Hi,
I know only "record macro" way, then I edit that recorded macro.
And I see that they always start Sub()

I sometimes see in your solutions
macros starting as "Private Sub..."
How do we run such macros ?

Thanks,

Cousin Excel

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 10,124
Default Private Sub() - Sub()

This is done so they won't be seen. Goto the editor to fire.

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"CousinExcel" wrote in message
...
Hi,
I know only "record macro" way, then I edit that recorded macro.
And I see that they always start Sub()

I sometimes see in your solutions
macros starting as "Private Sub..."
How do we run such macros ?

Thanks,

Cousin Excel


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Private Sub Workbook_Open() doesn't run Steve Starr Excel Discussion (Misc queries) 4 April 3rd 11 05:05 AM
Private sub problem sby Excel Worksheet Functions 1 November 28th 07 04:50 PM
Private Sub CommandButton1_Click() Bob Excel Discussion (Misc queries) 2 December 2nd 06 02:14 AM
Common Private Sub Booker Excel Discussion (Misc queries) 1 November 15th 05 08:50 AM
Private sub Mark New Users to Excel 3 April 6th 05 03:36 PM


All times are GMT +1. The time now is 12:37 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"