+ Reply to Thread
Results 1 to 8 of 8

click - hide/unhide column

Hybrid View

  1. #1
    Registered User
    Join Date
    09-30-2009
    Location
    kosice, slovakia
    MS-Off Ver
    Excel 2003
    Posts
    17

    Re: click - hide/unhide column

    Thank you mrice, working like charm. Now i need to add a slight modification to the formula, how can i modify it to get this result: every second row will be hiding when clicking on the row top of it. ( there will be hidden picture in hide/unhide rows - 2,4,6,8,10... by clicking on 1,3,5,7,9...

  2. #2
    Forum Expert mrice's Avatar
    Join Date
    06-22-2004
    Location
    Surrey, England
    MS-Off Ver
    Excel 2013
    Posts
    4,967

    Re: click - hide/unhide column

    Try this variation.

    Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
    If Target.Columns.Count = 1 And WorksheetFunction.IsOdd(Target.Column) = True Then
        
    
        If Columns(Target.Column + 1).Hidden = True Then
            Columns(Target.Column + 1).Hidden = False
            For N = 1 To ActiveSheet.DrawingObjects.Count
                If ActiveSheet.DrawingObjects(N).TopLeftCell.Column = Target.Column + 1 Then
                    ActiveSheet.DrawingObjects(N).Visible = True
                End If
            Next N
        Else
            Columns(Target.Column + 1).Hidden = True
            For N = 1 To ActiveSheet.DrawingObjects.Count
                If ActiveSheet.DrawingObjects(N).TopLeftCell.Column = Target.Column + 1 Then
                    ActiveSheet.DrawingObjects(N).Visible = False
                End If
            Next N
        End If
    End If
    End Sub

+ 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