+ Reply to Thread
Results 1 to 10 of 10

why does "Private Sub Workbook_open" not work?

  1. #1
    Registered User
    Join Date
    05-15-2009
    Location
    Springfield Missouri
    MS-Off Ver
    Excel 2003
    Posts
    46

    why does "Private Sub Workbook_open" not work?

    Im trying to get Excel to load some formulas when the workbook opens, however it doesn't. Why would this be?

  2. #2
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689

    Re: why does "Private Sub Workbook_open" not work?

    What code did you put in what module?
    Entia non sunt multiplicanda sine necessitate

  3. #3
    Registered User
    Join Date
    05-15-2009
    Location
    Springfield Missouri
    MS-Off Ver
    Excel 2003
    Posts
    46

    Re: why does "Private Sub Workbook_open" not work?

    here's an example

    Private Sub workbook_open()
    Sheets(2).Range("B19").Formula = "=B17"
    End sub
    Ive tried it in the module and where you can code for the indivudual page. Do you have to create a macro?

  4. #4
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: why does "Private Sub Workbook_open" not work?

    This macro belongs in the ThisWorkbook module.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  5. #5
    Registered User
    Join Date
    05-15-2009
    Location
    Springfield Missouri
    MS-Off Ver
    Excel 2003
    Posts
    46

    Re: why does "Private Sub Workbook_open" not work?

    when i do 2 it works fine. when i add more than that i get this error

    Run time error '1004':
    Application-defined or object-defined error

    I am so confused

  6. #6
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689

    Re: why does "Private Sub Workbook_open" not work?

    Add more what?

  7. #7
    Registered User
    Join Date
    05-15-2009
    Location
    Springfield Missouri
    MS-Off Ver
    Excel 2003
    Posts
    46

    Re: why does "Private Sub Workbook_open" not work?

    add more formulas such using this just changing numbers:

    Sheets(2).Range("B19").Formula = "=B17"
    and get the error i posted above

  8. #8
    Forum Contributor daksh1981's Avatar
    Join Date
    04-15-2009
    Location
    India
    MS-Off Ver
    2003 & 2007
    Posts
    110

    Re: why does "Private Sub Workbook_open" not work?

    I will suggest to attach a example sheet with your post. So that we can debug it.

  9. #9
    Registered User
    Join Date
    05-15-2009
    Location
    Springfield Missouri
    MS-Off Ver
    Excel 2003
    Posts
    46

    Re: why does "Private Sub Workbook_open" not work?

    I cant get it to come up in a sample spreadsheet... i dont know

  10. #10
    Registered User
    Join Date
    05-15-2009
    Location
    Springfield Missouri
    MS-Off Ver
    Excel 2003
    Posts
    46

    Re: why does "Private Sub Workbook_open" not work?

    Ok it has something to do with my spreadsheet. im going to have to start over.

    thanks for the help

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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