+ Reply to Thread
Results 1 to 4 of 4

Hiding columns using a macro after rows have been filtered using a macro

  1. #1
    Registered User
    Join Date
    08-26-2013
    Location
    sydney , australia
    MS-Off Ver
    Excel 2010
    Posts
    3

    Post Hiding columns using a macro after rows have been filtered using a macro

    Hi,

    This is the error I get "Unable to set the Hidden property of the Range class"

    Thanks


    Hi,

    Hope some can help me. I have a spread sheet in which I have created a macro to filter a number of rows. When I don't filter the rows the column macro works fine ( hides three columns with "plan" data). When I filter the rows using a selection criteria and then try and hide the same columns it does not work. Can some one please advise how I can over come this problem.

    Thank you
    Last edited by ivandc1234; 08-26-2013 at 04:38 AM.

  2. #2
    Valued Forum Contributor
    Join Date
    02-08-2012
    Location
    Newcastle, Australia
    MS-Off Ver
    Excel 2007 and Excel 2010
    Posts
    1,429

    Re: Hiding columns using a macro after rows have been filtered using a macro

    Hi,

    Can you please upload your workbook containing the code so that I can examine your code and debug it in context.

    Thanks

  3. #3
    Registered User
    Join Date
    08-26-2013
    Location
    sydney , australia
    MS-Off Ver
    Excel 2010
    Posts
    3

    Re: Hiding columns using a macro after rows have been filtered using a macro

    Thanks for the quick response. Below is the code for the two sections of the workbook.

    Code to hide columns:

    Sub Hide_Plan()
    ' Hide_Plan Macro
    Columns("I:N").Hidden = True
    Range("F7").Select
    End Sub

    The above code works fine if I don't filter the rows using the code below. I need to filter rows and then hide the above columns!


    Code to filter rows:

    Sub Button52_Click()
    ' Show all v1 tasks ( I have tagged these tasks with a V1 tag )
    Dim strMeeting As String
    strMeeting = Range("F7").Value
    Application.ScreenUpdating = False
    ActiveSheet.Unprotect
    If ("All" = strMeeting) Then
    Selection.AutoFilter Field:=5
    Else
    Selection.AutoFilter Field:=5, Criteria1:=strMeeting
    End If
    ' Clear the selection filter
    Selection.AutoFilter Field:=1, Criteria1:="V1"
    Selection.AutoFilter Field:=2
    Selection.AutoFilter Field:=3
    Selection.AutoFilter Field:=4
    Range("F12").Select
    ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True, AllowFiltering:=False
    Application.ScreenUpdating = True
    End Sub

  4. #4
    Valued Forum Contributor
    Join Date
    02-08-2012
    Location
    Newcastle, Australia
    MS-Off Ver
    Excel 2007 and Excel 2010
    Posts
    1,429

    Re: Hiding columns using a macro after rows have been filtered using a macro

    Hmm,

    I just tested this and I am able to hide columns before and after I have filtered rows using a macro. Could you please upload your workbook for me to take a look at.

    Thanks

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Macro Programming - Hiding rows/columns based on certain text
    By JamesTann in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 11-10-2012, 06:22 AM
  2. Macro - hiding columns
    By Koda7 in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 06-14-2010, 11:22 AM
  3. Hiding columns with a macro
    By bmw30csl in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 05-13-2009, 12:56 PM
  4. hiding columns using macro
    By EddyAddelan in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-14-2006, 09:18 AM
  5. Macro Help - Hiding columns
    By webee33 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-08-2006, 11:56 AM

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