+ Reply to Thread
Results 1 to 2 of 2

Hidden Columns

  1. #1
    Registered User
    Join Date
    03-04-2005
    Posts
    24

    Hidden Columns

    Hi Guys,

    I have been asked to automate some work to an Excel Workbook.
    In the workbook some columns have been added with formula's and then hidden.
    I am looping through the columns and when I find a certain cell of that column empty, I know that this is the next column to work in. What I want to do is unhide the column in code.
    If I write:
    Columns("EC:EC").Select
    Selection.EntireColumn.Hidden = False
    All works ok but what I want to write is
    Columns(LoopColumnCount & ":" & LoopColumnCount ).Select
    Selection.EntireColumn.Hidden = False
    where LoopColumnCount is the variable I am using to loop through the columns. at the end it may = 122
    How do I convert the value 122 into the correct cell ref, i.e. "EC" , so I can use Columns("EC:EC").Select
    Hope this makes sense.

    Thanks for your help,

    Steve.

  2. #2
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258
    Hello Steve,

    Instead of converting the column number back to a text value, here is a way to do it by selecting the entire column by the loop number.

    Range("A1").Offset(0, LoopColumnCount - 1).EntireColumn.Select
    Selection.EntireColumn.Hidden = False


    Leith Ross

+ 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