+ Reply to Thread
Results 1 to 3 of 3

VBA to unhide columns

Hybrid View

  1. #1
    Registered User
    Join Date
    08-31-2005
    Posts
    1

    VBA to unhide columns

    Hi
    Can anyone give me a code to unhide or autofit columns automatically when the worksheet is opened?
    I tried to modify an On entry script I got off the web but can't figure it out.
    Thanks

  2. #2
    Norman Jones
    Guest

    Re: VBA to unhide columns

    Hi Shiney,

    You do not give enough detail to be specific, but the following code will
    unhide column A and autofit columns C:E on Sheet1 when the workbook is
    opened:

    '=====================>>
    Private Sub Workbook_Open()

    With Me.Sheets("Sheet1")
    Columns("A:A").Hidden = False
    Columns("C:E").AutoFit
    End With

    End Sub
    '<<=====================


    This is workbook event code and should be pasted into the workbook's
    ThisWorkbook module *not a standard module or a sheet module):

    ************************************************************
    Right-click the Excel icon on the worksheet
    (or the icon to the left of the File menu if your workbook is maximised)

    Select 'View Code' from the menu and paste the code.

    Alt-F11 to return to Excel.
    ************************************************************

    ---
    Regards,
    Norman



    "shiney" <shiney.1umfmc_1125479133.6956@excelforum-nospam.com> wrote in
    message news:shiney.1umfmc_1125479133.6956@excelforum-nospam.com...
    >
    > Hi
    > Can anyone give me a code to unhide or autofit columns automatically
    > when the worksheet is opened?
    > I tried to modify an On entry script I got off the web but can't figure
    > it out.
    > Thanks
    >
    >
    > --
    > shiney
    > ------------------------------------------------------------------------
    > shiney's Profile:
    > http://www.excelforum.com/member.php...o&userid=26817
    > View this thread: http://www.excelforum.com/showthread...hreadid=400706
    >




  3. #3
    Xcelion
    Guest

    RE: VBA to unhide columns

    Shiny ,

    You could use like this open event
    Sheet1.Columns.Hidden = True
    Sheet1.Columns.AutoFit

    Thanks
    Xcelion



    "shiney" wrote:

    >
    > Hi
    > Can anyone give me a code to unhide or autofit columns automatically
    > when the worksheet is opened?
    > I tried to modify an On entry script I got off the web but can't figure
    > it out.
    > Thanks
    >
    >
    > --
    > shiney
    > ------------------------------------------------------------------------
    > shiney's Profile: http://www.excelforum.com/member.php...o&userid=26817
    > View this thread: http://www.excelforum.com/showthread...hreadid=400706
    >
    >


+ 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