+ Reply to Thread
Results 1 to 2 of 2

Autofit sub runs, but not when called

  1. #1
    Registered User
    Join Date
    08-19-2014
    Location
    San Francisco Bay Area, California
    MS-Off Ver
    Excel 2010
    Posts
    13

    Autofit sub runs, but not when called

    I have a sub Format_MySweetSheet to autofit rows and every nth column (n = 3) which works fine. It is the last sub called by the main macro. My quandary is why Format_MySweetSheet doesn't appear to run when it is called by the main macro.

    The main macro in Module0 calls Sub1, Sub2, and Sub3.
    Sub1 is in Module1 and calls Sub1a, Sub1b, Sub1c
    Sub2 is in Module2 and calls Sub2a, Sub2b, Sub2c
    Sub3 is in Module3 and calls Sub3a, Sub3b, Sub3c, Sub3d, Sub3e, and Format_MySweetSheet

    Everything is in one workbook.

    - Sub3e works with the same sheet as Format_MySweetSheet, and ends by selecting cell A1 of that sheet.
    - After I run the main macro, Sub1a through Sub3e have all run, yet the column widths and row heights have not been adjusted.
    - When I run Format_MySweetSheet separately and immediately after, the columns and rows are adjusted as desired.

    Any ideas, please?

    The code for the autofit sub is:

    Please Login or Register  to view this content.
    Many thanks!

  2. #2
    Registered User
    Join Date
    08-19-2014
    Location
    San Francisco Bay Area, California
    MS-Off Ver
    Excel 2010
    Posts
    13

    Re: Autofit sub runs, but not when called

    To clarify my post: Sub Format_MySweetSheet does run to the extent that the cell borders are drawn. It is only the autofit of column width and row height which doesn't work the first time (yet does the second time).

    Thanks again

+ 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. VBA runs slow locally, runs fine when connected remotely
    By jbzy324 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 07-01-2015, 10:05 PM
  2. How to write a code so that a macro called "Mega" runs only once if cell value A1 > 0
    By omega0010 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 08-31-2014, 10:47 AM
  3. [SOLVED] Softball Runs for Runs against
    By firefight16 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 05-30-2014, 07:47 PM
  4. [SOLVED] Code that loops through number of files and runs a called sub on each works sometimes. Why
    By jbwitty in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 10-01-2013, 05:34 PM
  5. [SOLVED] Macro runs fine but fails when called up via VBA
    By nighttrainrex in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-30-2013, 08:59 PM
  6. Macro runs well but not when called by another ??
    By james 35 in forum Excel Programming / VBA / Macros
    Replies: 14
    Last Post: 02-20-2013, 08:49 AM
  7. Replies: 3
    Last Post: 03-29-2012, 01:58 PM

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