+ Reply to Thread
Results 1 to 2 of 2

Hid and unhide and clear contents for specific columns at the same time

  1. #1
    hamad.fatima@gmail.com
    Guest

    Hid and unhide and clear contents for specific columns at the same time

    I have a serious problem with excel programming and i am not able to
    figureout how to do the following funtions.

    I have 24 columns. names Jan -Dec ( Actual) then Jan- Dec (Forecast).
    There is one reference cell A1 ( for current month).
    - If A1= Jan, I want macro to hide FEB-DEC 9 Actual , and leave
    FEB-DEC (forecast).
    -If A1= FEB , I want macro to unhide FEB Actual and hide MAR-Dec (
    actual) and at the same time clear contents in FEB (forecast) and hide
    feb (forecast ).

    ANd so on


    I would really appreciate if somene could help me figure out this
    problem.

    Thanks


  2. #2
    Don Guillett
    Guest

    Re: Hid and unhide and clear contents for specific columns at the same time

    Use one of these in the sheet module where cell a1 contains the number of
    the month.

    Sub hidecols()
    Columns.Hidden = False
    mc = Range("a1") + 1
    Range(Cells(1, mc), Cells(1, 12)).EntireColumn.Hidden = True
    End Sub

    'Automatic every time you change cell a1
    Private Sub Worksheet_Change(ByVal Target As Range)
    If Target.Address <> "$A$1" Then Exit Sub
    Columns.Hidden = False
    mc = Target + 1
    Range(Cells(1, mc), Cells(1, 12)).EntireColumn.Hidden = True
    End Sub

    --
    Don Guillett
    SalesAid Software
    dguillett1@austin.rr.com
    <hamad.fatima@gmail.com> wrote in message
    news:1156260462.231698.127570@m73g2000cwd.googlegroups.com...
    >I have a serious problem with excel programming and i am not able to
    > figureout how to do the following funtions.
    >
    > I have 24 columns. names Jan -Dec ( Actual) then Jan- Dec (Forecast).
    > There is one reference cell A1 ( for current month).
    > - If A1= Jan, I want macro to hide FEB-DEC 9 Actual , and leave
    > FEB-DEC (forecast).
    > -If A1= FEB , I want macro to unhide FEB Actual and hide MAR-Dec (
    > actual) and at the same time clear contents in FEB (forecast) and hide
    > feb (forecast ).
    >
    > ANd so on
    >
    >
    > I would really appreciate if somene could help me figure out this
    > problem.
    >
    > Thanks
    >




+ 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