Results 1 to 10 of 10

Short Macro Only Works In Certain Workbooks

Threaded View

  1. #1
    Registered User
    Join Date
    02-11-2014
    Location
    New York, US
    MS-Off Ver
    Excel 2016
    Posts
    10

    Short Macro Only Works In Certain Workbooks

    I have a short macro in my PERSONAL workbook which works in all known workbooks on my work computer except for one.
    I can't figure out what was special about that one. I set the same macro up on my home computer and it works on some, errors out on others. Here it is. I emboldened the section which is highlighted yellow when I run debugger.

    Sub Autosize_Comments()					
    					
    '					
    ' Autosize_Comments Macro					
    ' Auto-sizes all comments in range					
    '					
    ' Keyboard Shortcut: Ctrl+Shift+C					
     					
    Dim xComment As Comment					
    For Each xComment In Application.ActiveSheet.Comments					
        xComment.Shape.TextFrame.AutoSize = True					
    Next					
    End Sub
    Could someone please point out what is going wrong here?
    Or point me in the right direction on what to investigate?
    I can't remember ever having a macro that works sporadically in the way that this one is.

    In both cases I am running Excel 2016 on Windows 10.
    Thank you very much for any help.
    Last edited by Leith Ross; 09-20-2018 at 02:57 PM. Reason: Added Code Tags

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Macro to paste between workbooks only works in single instance of Excel
    By xdrenched in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-22-2016, 05:45 AM
  2. [SOLVED] How to make a one-click macro which only works on other workbooks
    By Petijandro in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-09-2015, 08:27 AM
  3. Macro that runs when ran from Macro menu, but stops when using short cut keys...
    By Joven76 in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 09-12-2014, 02:29 PM
  4. [SOLVED] workbooks.open not working in xl2010 but works in xs2003
    By symaxf in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 11-13-2013, 11:35 PM
  5. index & mach works wthin workbook but not seperate workbooks help!!!
    By mmcoordes in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 02-19-2013, 09:25 PM
  6. Formula only works with referenced workbooks open
    By woodrbw in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 05-19-2012, 07:26 AM
  7. Problem with macro that works on multiple workbooks
    By vandalizmx in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 04-13-2007, 11:36 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