+ Reply to Thread
Results 1 to 4 of 4

View hidden column with inputbox

Hybrid View

  1. #1
    Valued Forum Contributor marreco's Avatar
    Join Date
    07-02-2011
    Location
    Brazil
    MS-Off Ver
    Excel 2010
    Posts
    1,862

    View hidden column with inputbox

    hi
    I would like a inputbox, allow me to choose a hidden column and display it.

    example:
    I have a spreadsheet and Column "A", "D" and "G", they are hidden.
    Pressing a button will open a inputbox macro, I type it I want to display column.

    Thank
    Last edited by marreco; 02-11-2012 at 07:51 PM.

  2. #2
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    Win10/MSO2016
    Posts
    12,965

    Re: View hidden column with inputbox

    Option Explicit
    
    Sub ShowCols()
        Dim Col             As Variant, _
            Check           As Variant, _
            ListOfColumns   As String, _
            Choice          As String, _
            Comma           As String
    
        'find all the hidden columns in the sheet and build a list
        For Each Col In ActiveSheet.Columns
            If Col.Hidden = True Then
                ListOfColumns = ListOfColumns & Comma & Left(Col.Address(0, 0), 1)
                Comma = ","
            End If
        Next Col
        
        'No hidden columns found in sheet; tell him and exit the macro
        If ListOfColumns = "" Then
            MsgBox "No hidden columns"
            Exit Sub
        End If
        
        'present the user with a list of hidden columns to choose from
        Choice = InputBox("enter one of the columns listed below" & vbCrLf & ListOfColumns)
        
        'check if the user choice is in the list, if not tell him and exit the macro
        Check = InStr(ListOfColumns, UCase(Choice))
        
        If Check = 0 Then
            MsgBox Choice & " was not in the list"
            Exit Sub
        End If
        
        'unhide the column selected
        Columns(Choice).EntireColumn.Hidden = False
        
        
    End Sub
    Last edited by protonLeah; 02-11-2012 at 07:35 PM.
    Ben Van Johnson

  3. #3
    Valued Forum Contributor marreco's Avatar
    Join Date
    07-02-2011
    Location
    Brazil
    MS-Off Ver
    Excel 2010
    Posts
    1,862

    Smile Re: View hidden column with inputbox

    Thank you for responding!
    Thank you for responding!
    Boy you are a master of Excel, a genius!

    was very good!

  4. #4
    Valued Forum Contributor marreco's Avatar
    Join Date
    07-02-2011
    Location
    Brazil
    MS-Off Ver
    Excel 2010
    Posts
    1,862

    Re: View hidden column with inputbox

    My answer was not counted as two.

    Thank you protonLeah

+ 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