+ Reply to Thread
Results 1 to 6 of 6

Apply code to entire workbook.

  1. #1
    Registered User
    Join Date
    09-17-2018
    Location
    Beijing, China
    MS-Off Ver
    Office 360, 2016
    Posts
    75

    Apply code to entire workbook.

    Hello all. I have found a Macro online to help me solve one of my issues, but this macro is coded to only work on one sheet and I am wondering how to change it to work for the entire workbook. The code is as follows:

    HTML Code: 

    I am looking to double click a cell in either Column C or G and have it copied to Column I in the same row. As of now this works but only on my sheet titled Week 4.

    Any help is appreciated!
    Last edited by kgall89; 09-26-2018 at 07:43 AM.

  2. #2
    Forum Expert XLent's Avatar
    Join Date
    10-13-2010
    Location
    Northumberland, UK
    MS-Off Ver
    various
    Posts
    2,704

    Re: Apply code to entire workbook.

    PLease add code tags.

    Check out ThisWorkbook... the same events are available but with Workbook level scope, e.g.:

    Please Login or Register  to view this content.
    Note: additional Sh Object, this defines the Sheet triggering the event.

  3. #3
    Registered User
    Join Date
    09-17-2018
    Location
    Beijing, China
    MS-Off Ver
    Office 360, 2016
    Posts
    75

    Re: Apply code to entire workbook.

    I apologize XLent, I am extremely new to excel and coding, I believe I edited the question to include tags now? I was able to get this code by googling my issue and finding a similar issue, then changing what I knew to fit my workbook.

    Thank you for the response and help!
    Last edited by kgall89; 09-26-2018 at 08:35 AM.

  4. #4
    Registered User
    Join Date
    09-17-2018
    Location
    Beijing, China
    MS-Off Ver
    Office 360, 2016
    Posts
    75

    Re: Apply code to entire workbook.

    When I add in the Sh As Object, and try to use the double click I am shown this error:

    Compile error:

    Procedure declaration does not match description of event or procedure having the same name

  5. #5
    Forum Expert XLent's Avatar
    Join Date
    10-13-2010
    Location
    Northumberland, UK
    MS-Off Ver
    various
    Posts
    2,704

    Re: Apply code to entire workbook.

    To clarify, the code should reside in ThisWorkbook object, not the Sheet object where you previous event would have been placed.

    edit: added below link for ease of reference:

    https://www.myonlinetraininghub.com/...ents-excel-vba

  6. #6
    Registered User
    Join Date
    09-17-2018
    Location
    Beijing, China
    MS-Off Ver
    Office 360, 2016
    Posts
    75

    Re: Apply code to entire workbook.

    Okay, I did not have that in the correct object. I moved/edited and this works!

    Thank you very much for your time and patience, XLent

+ 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] Apply conditional formatting to the entire workbook
    By YasserKhalil in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-11-2015, 11:41 AM
  2. [SOLVED] Apply the code for entire row 4 help
    By mso3 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 08-04-2014, 02:51 PM
  3. Apply Macro to entire workbook
    By Msteenbeke in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-27-2012, 03:44 PM
  4. Replies: 2
    Last Post: 09-09-2011, 05:42 AM
  5. How to apply macro to an entire workbook
    By David777 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 09-09-2011, 05:14 AM
  6. [SOLVED] RE: How to apply a format to an entire workbook
    By Peo Sjoblom in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 05-17-2005, 02:06 PM
  7. [SOLVED] How to apply a format to an entire workbook
    By mdeanda in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 05-17-2005, 02: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