+ Reply to Thread
Results 1 to 3 of 3

Workbook_Open() Not working

  1. #1
    Registered User
    Join Date
    04-29-2015
    Location
    London, England
    MS-Off Ver
    Excel 2010
    Posts
    82

    Workbook_Open() Not working

    Hi guys,

    I know you can help, I'm not skilled at VBA and I have a very simple request. Currently the following code works in the sheet module:

    Please Login or Register  to view this content.
    However, it won't work when I open the workbook. I believe this is because I don't have it in the "This Workbook" module. However, if I do paste this in, how would it know what sheet to use? Furthermore, I already have 1 other VBA code in the "This Workbook" module. How can I use both?

    Thanks!
    Last edited by Quasis; 09-28-2015 at 02:30 AM.

  2. #2
    Forum Expert skywriter's Avatar
    Join Date
    06-09-2014
    Location
    USA
    MS-Off Ver
    2016
    Posts
    2,760

    Re: Workbook_Open() Not working

    What sheet do you want it to use?
    Share the other code in the ThisWorkbook module.
    Click the * Add Reputation button in the lower left hand corner of this post to say thanks.

    Don't forget to mark this thread SOLVED by going to the "Thread Tools" drop down list above your first post and choosing solved.

  3. #3
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Workbook_Open() Not working

    Hi,
    Put this code either before or after the current code.

    If the other VBA code also operates on the same sheet on which you want this code to operate then the simplest solution would be to make the first instruction in the workbook open event procedure.

    Please Login or Register  to view this content.
    If the two code blocks operate on different sheets then either use the .Activate instruction to activate the relevant sheet before its code runs, or preferably since it's a better practice fully qualify the Range("B" & r)...instruction with the sheet name. the easiest way to do this is to top and tail yourf code with a 'WITH' and 'END WITH' instruction. e.g

    Please Login or Register  to view this content.
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Workbook_Open() Not Working automatically
    By davidpierce in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 05-09-2015, 09:33 PM
  2. Workbook_Open event do not working?
    By Dumy in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 04-11-2013, 04:09 AM
  3. Workbook_Open() not working
    By stuartglass in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 01-03-2011, 12:59 PM
  4. Workbook_open Event Not Working
    By mllm in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-14-2008, 03:19 PM
  5. [SOLVED] Workbook_Open - Multiple Events not all working
    By Punsterr in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-06-2005, 03:05 AM
  6. [SOLVED] Workbook_Open not working
    By Sheena N via OfficeKB.com in forum Excel General
    Replies: 4
    Last Post: 05-05-2005, 09:06 PM
  7. XL97 Private Sub Workbook_Open() Not Working
    By Pete in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 04-19-2005, 04:06 PM

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