+ Reply to Thread
Results 1 to 3 of 3

Is there a conditional formula to hide and unhide columns?

  1. #1
    Frederic
    Guest

    Is there a conditional formula to hide and unhide columns?

    Imagine you have a column A, where codes for certain categories are listed. I
    would like Columns B and C, which are hidden, to be unhidden, when a certain
    code is being entered in column A.

  2. #2
    David
    Guest

    RE: Is there a conditional formula to hide and unhide columns?

    Hi,
    Hope this will help.
    Private Sub Worksheet_Change(ByVal Target As Range)
    Col = ActiveCell.Column
    Stop
    If Col = 1 And ActiveCell.Value = "Certain Value" Then
    ActiveCell.Columns("B:C").EntireColumn.Select
    Selection.EntireColumn.Hidden = False
    ActiveCell.Select
    Else
    End If
    End Sub

    "Frederic" wrote:

    > Imagine you have a column A, where codes for certain categories are listed. I
    > would like Columns B and C, which are hidden, to be unhidden, when a certain
    > code is being entered in column A.


  3. #3
    Bob Phillips
    Guest

    Re: Is there a conditional formula to hide and unhide columns?

    A bit simpler, no selects

    Private Sub Worksheet_Change(ByVal Target As Range)
    If Target.column = 1 And Target.Value = "Certain Value" Then
    Columns("B:C")..Hidden = False
    End If
    End Sub

    Also, this code should go into the appropriate sheet code module, not a
    standard code module.


    --
    HTH

    Bob Phillips

    "David" <[email protected]> wrote in message
    news:[email protected]...
    > Hi,
    > Hope this will help.
    > Private Sub Worksheet_Change(ByVal Target As Range)
    > Col = ActiveCell.Column
    > Stop
    > If Col = 1 And ActiveCell.Value = "Certain Value" Then
    > ActiveCell.Columns("B:C").EntireColumn.Select
    > Selection.EntireColumn.Hidden = False
    > ActiveCell.Select
    > Else
    > End If
    > End Sub
    >
    > "Frederic" wrote:
    >
    > > Imagine you have a column A, where codes for certain categories are

    listed. I
    > > would like Columns B and C, which are hidden, to be unhidden, when a

    certain
    > > code is being entered in column A.




+ 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