Results 1 to 9 of 9

create new workbook and sheet with vba code in it

Threaded View

  1. #1
    Registered User
    Join Date
    03-30-2011
    Location
    Los Angeles, Ca
    MS-Off Ver
    Excel 2003
    Posts
    8

    create new workbook and sheet with vba code in it

    Hello everyone this is my first post here and I hope I am explaining myself well. I have a macro that creates a new workbook with sever worksheets in it. The new worksheets get formatted with color, words and math formulas in it. This part all works perfect. The part that I can not figure out it how to add VBA to a particular sheet or sheet object (not a userform or module) . I am trying to add the code :
    Private Sub Worksheet_SelectionChange(ByVal target As Range)
    If target.Address = "$D$1" Then caly2.Show
    End Sub
    So if some clicks in cell D1 on a worksheet it will trigger a userform (this userform opens up the calendar so that they can select a date, that then populates the cell, this part works fine if I manually enter the code by right clicking on the tab, selecting view code and entering it. So again how do I create this new tab/worksheet with this code already in it.

    I am in excel 2007.

    Thanks in advance
    Eric
    Last edited by pike; 03-31-2011 at 12:10 AM. Reason: add code tags

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1