+ Reply to Thread
Results 1 to 5 of 5

Changing the width of a cell with a formula

  1. #1
    Registered User
    Join Date
    07-08-2009
    Location
    Indiana
    MS-Off Ver
    Excel 2003
    Posts
    3

    Changing the width of a cell with a formula

    Is it possible to change the width of a column with a formula? For example, if a cell is empty, I want to make its column width zero, but if the cell contains data, I want to make its width something other than zero.

    Any help would be appreciated!

  2. #2
    Forum Expert Paul's Avatar
    Join Date
    02-05-2007
    Location
    Wisconsin
    MS-Off Ver
    2016/365
    Posts
    6,887

    Re: Changing the width of a cell with a formula

    Hi Rick, and welcome to the forum.

    This can be done via a macro on the Worksheet_Change event, however it seems messy to me especially if multiple columns might result in 0 based on a user change. I'd recommend uploading a sample worksheet with sample data and how it looks before and after a value change.

  3. #3
    Registered User
    Join Date
    07-08-2009
    Location
    Indiana
    MS-Off Ver
    Excel 2003
    Posts
    3

    Re: Changing the width of a cell with a formula

    Thanks for the welcome, Paul

    I have attached a sample file, and here are some screenshots of what I'm trying to do. Perhaps there is another way of accomplishing what I want to do other than changing the width of the column, so if you know of any, let me know

    Here is a screenshot of the sample data set:
    \1

    I am maintaining the database on Sheet 1, and on Sheet 2, I am displaying just the names that have a number greater than zero in 'Days Late' (I am deriving this information using the formula =IF(Sheet1!B2>0, Sheet1!B1, "") copied across all the cells):
    \1

    However, I want Sheet 2 to look like this:
    \1

    I thought it might be easiest to do using column widths, however, if there is another way, that'd be cool too

  4. #4
    Forum Expert Palmetto's Avatar
    Join Date
    04-04-2007
    Location
    South Eastern, USA
    MS-Off Ver
    XP, 2007, 2010
    Posts
    3,978

    Re: Changing the width of a cell with a formula

    If you are open to a change in your sheet structure then you could accomplish this very easily using AutoFilter.

    To do this you would need your names and values going down the columns instead of across the rows. It would only be a matter of filtering on rows where the value is greater than zero.

  5. #5
    Registered User
    Join Date
    07-08-2009
    Location
    Indiana
    MS-Off Ver
    Excel 2003
    Posts
    3

    Thumbs up Re: Changing the width of a cell with a formula

    YES! That worked GREAT!! Thanks Palmetto!

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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