Results 1 to 6 of 6

Macro for hiding pre-defined columns

Threaded View

  1. #1
    Forum Contributor
    Join Date
    12-02-2008
    Location
    India
    Posts
    118

    Macro for hiding pre-defined columns

    Hey all,
    I'm updating my workbook to add some more features that would make my workbook more userfriendly.
    I'm trying to find a macro that would hide specific combination of columns based on what I want to do when i open this workbook so that i could avoid wasting time to keep tabbing and finish punching the data in lesser time.

    To do this i'm planning to make a switchboard page in my first sheet with a list and give them radio buttons:
    Full View Unhide all Columns
    New Trip Entry Hide columns C,D,E,J,K,L,M,N,Z-AL,AN-AU
    Acknowledgement Entry Hide columns E,M,N,S,T,U,V,W,X,Y,Z,AA,AF-AU
    Bill Entry ....
    Receipt Entry ....
    Balance Payment Entry ....
    Delay Report ....
    Vehicle Running Report ....

    I tried recording a macro to do the above but it is unbelievably long and ineffective as it hides all the columns from A to AU. Somehow, I did manage to find something

    Private Sub OptionButton2_Click()
    Range("A1,C1,F1,H1,J1,K1,L1,M1,N1,O1,P1,Q1,R1,V1,W1,X1").EntireColumn.Hidden = True
    
    End Sub
    But the Above code works on the same worksheet as the button is in... and I want it to work on "Datasheet" worksheet

    I know I have to add activate sheet code but i dont know the language.
    Edit: I just realised there is one more thing that needs to be done before actually hiding columns and that is to unhide all columns.

    Please Help.

    Thanks And Regards

    Mohit
    Last edited by mohitspamz; 08-05-2010 at 05:47 AM.

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