Results 1 to 5 of 5

Column Width

Threaded View

  1. #3
    Valued Forum Contributor rollis13's Avatar
    Join Date
    01-26-2012
    Location
    Cordenons
    MS-Off Ver
    Excel 2016 32bit - Win 11
    Posts
    935

    Re: Column Width

    Change your code to:
    Option Explicit
    
    Private Sub CommandButton100_Click()
    
        Dim n As Long
        
        Application.ScreenUpdating = False
        For n = 2 To Range("B7").CurrentRegion.Columns.Count + 200
            If InStr(Cells(7, n).Value, Range("H1").Value) >= 1 Then
                Cells(7, n).ColumnWidth = 8.43
            Else
                Cells(7, n).ColumnWidth = 0
            End If
        Next n
        Application.ScreenUpdating = True
        
    End Sub
    Last edited by rollis13; 11-15-2013 at 01:43 PM.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Column Width vs. Text Width
    By jlt199 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 07-31-2013, 11:45 AM
  2. [SOLVED] Automatically adjust column width to longest value in column
    By Grimace in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-16-2013, 08:18 PM
  3. how to move cells in a column with different column width
    By ajish002 in forum Excel Charting & Pivots
    Replies: 1
    Last Post: 08-07-2012, 03:26 PM
  4. Set Column Width Based On Total Width Of Other Columns
    By rayneraingoaway in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-28-2006, 06:10 PM
  5. [SOLVED] Setting column width if #### appears in column
    By qwerty in forum Excel Programming / VBA / Macros
    Replies: 14
    Last Post: 04-09-2006, 11:10 AM

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