Inserting VBA code into macro created sheets
Thanks Thanks:  0
Likes Likes:  0
Results 1 to 3 of 3

Thread: Inserting VBA code into macro created sheets

  1. #1
    Board Regular
    Join Date
    Mar 2002
    Location
    Milwaukee, WI
    Posts
    105
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

     
    I have a macro that generates a few charts, and i would like to have the macro automatically include this code with each of those new chart sheets. How can I do this? The code to include is:

    Private Sub Chart_BeforeDoubleClick(ByVal ElementID As Long, ByVal Arg1 As Long, ByVal Arg2 As Long, Cancel As Boolean)
    Sheets("Sales Reports").Select
    End Sub

  2. #2
    Rest in Peace
    Join Date
    Feb 2002
    Posts
    1,582
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Hi jrnyman


    Easiest way is to save the Sheet with the code as a Template. Simple and very effective!

  3. #3
    Board Regular
    Join Date
    Mar 2002
    Location
    Milwaukee, WI
    Posts
    105
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

      
    That's a really good idea. Is there anyway to have my macro refer to a specific template when creating new sheets, or do I have to insert the code into the standard WorkSheet template?

User Tag List

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

 

 
DMCA.com