Results 1 to 4 of 4

Thread: Auto adjust for cells according to value using VBA

  1. #1
    Senior Member LalitPandey87's Avatar
    Join Date
    Sep 2011
    Posts
    222
    Rep Power
    14

    Cool Auto adjust for cells according to value using VBA

    Hi,

    Is it possoble through VBA to auto size the cell width according to the value in it.

    Thanx in Advance.

  2. #2
    Administrator Excel Fox's Avatar
    Join Date
    Mar 2011
    Posts
    1,402
    Rep Power
    10
    Are you looking for
    Code:
    Activecell.EntireColumn.Autofit
    ? This will adjust the width of the column. If this is not what you are looking for, can you clarify with an example?
    A dream is not something you see when you are asleep, but something you strive for when you are awake.

    It's usually a bad idea to say that something can't be done.

    The difference between dream and aim, is that one requires soundless sleep to see and the other requires sleepless efforts to achieve

    Join us at Facebook

  3. #3
    Junior Member
    Join Date
    Jul 2011
    Posts
    9
    Rep Power
    0
    Perhaps ! u can use this also

    Code:
    Sub test()
    Dim sht As Worksheet
    For Each sht In ThisWorkbook.Worksheets
            On Error Resume Next
            sht.Activate
            Cells.EntireColumn.AutoFit
        Next sht
    End Sub

  4. #4
    Senior Member LalitPandey87's Avatar
    Join Date
    Sep 2011
    Posts
    222
    Rep Power
    14
    Thanx for this useful function.
    Working!

Similar Threads

  1. Replies: 13
    Last Post: 06-10-2013, 09:05 AM
  2. Replies: 3
    Last Post: 06-01-2013, 11:31 AM
  3. Set Adjust A Button Top Left Position Programmatically
    By jeffrey159 in forum Access Help
    Replies: 5
    Last Post: 02-02-2013, 06:24 PM
  4. Auto Unique List
    By r_know in forum Excel Help
    Replies: 8
    Last Post: 07-19-2012, 09:28 PM
  5. VBA editor auto-deletes spaces at the ends of lines
    By LalitPandey87 in forum Excel Help
    Replies: 0
    Last Post: 06-26-2012, 07:53 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •