+ Reply to Thread
Results 1 to 4 of 4

VBA code for Autofit Columns in Excel

  1. #1
    Registered User
    Join Date
    08-14-2013
    Location
    Alberta, Canada
    MS-Off Ver
    Excel 2010
    Posts
    2

    VBA code for Autofit Columns in Excel

    Hey!
    I've got a protected spreadsheet that requires the user to input data in the unlocked cells.
    Currently, I have an autofit code that works for the cell the user has input the data into: ActiveSheet.Columns.AutoFit
    But it doesn't autofit the cell that displays the total of the cells (that the user does not input into).
    How can I get the locked cell to also autofit?

    Thanks!!

  2. #2
    Forum Contributor
    Join Date
    12-27-2012
    Location
    cebu, Philippines
    MS-Off Ver
    Excel 2016
    Posts
    210

    Re: VBA code for Autofit Columns in Excel

    you'll need to unlock the cells too before doing the autofit so it changes all the columns
    don't worry, there's a lot of people that are far more confused than you
    but if you liked what i suggested. Click for me the "Add Reputation" - that way, we'd be both happy.

  3. #3
    Registered User
    Join Date
    08-14-2013
    Location
    Alberta, Canada
    MS-Off Ver
    Excel 2010
    Posts
    2

    Re: VBA code for Autofit Columns in Excel

    I tried that, but it still won't autofit the "totals" columns, it will only autofit the cells that data is keyed into.

  4. #4
    Forum Contributor
    Join Date
    12-27-2012
    Location
    cebu, Philippines
    MS-Off Ver
    Excel 2016
    Posts
    210

    Re: VBA code for Autofit Columns in Excel

    can you post a copy of the workbook.. if possible.. just remove/replace the confidential data..

+ 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. Autofit all columns
    By cultavix in forum Excel General
    Replies: 2
    Last Post: 11-25-2008, 07:26 AM
  2. [SOLVED] Autofit code Issue
    By Joe in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 12-20-2005, 12:15 PM
  3. [SOLVED] autofit row code
    By Randy Starkey in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 03-25-2005, 08:06 AM
  4. [SOLVED] Autofit some columns
    By Me in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-20-2005, 05:06 PM
  5. autofit the excel columns
    By cindyxl in forum Excel General
    Replies: 0
    Last Post: 02-09-2005, 12:39 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