Results 1 to 9 of 9

Run-time error when hiding columns in protected workbook

Threaded View

  1. #1
    Registered User
    Join Date
    03-30-2013
    Location
    Chattanooga, TN
    MS-Off Ver
    Excel 2007
    Posts
    41

    Run-time error when hiding columns in protected workbook

    Hello,

    I have a listbox whose selections hide or unhide particular columns. I receive a run-time error 1004 only when I attempt to use this after just having activated the protected workbook. If I unprotect the workbook and reprotect it, the listbox functions properly from then on. I only have trouble if I haven't yet unprotected it.

    I have unlocked all of the cells in the columns I am hiding as I thought this might be the issue. Can anyone offer me some suggestions? Here is the code I'm using with the error messages listed below:

    Public Sub Hide_Graph()
        Application.ScreenUpdating = False
        Application.EnableEvents = False
        If [Display_Selected] = 2 Then
            Worksheets("Exhibit Summary").Range("G:Y").EntireColumn.Hidden = True
            Worksheets("Exhibit Summary").Range("AA:AJ").EntireColumn.Hidden = False
        ElseIf [Display_Selected] = 1 Then
            Worksheets("Exhibit Summary").Range("AA:AJ").EntireColumn.Hidden = True
            Worksheets("Exhibit Summary").Range("G:Y").EntireColumn.Hidden = False
        Else
            Worksheets("Exhibit Summary").Range("G:AJ").EntireColumn.Hidden = False
        End If
        ActiveSheet.Range("A1").Select
        Application.EnableEvents = True
        Application.ScreenUpdating = True
    End Sub
    “400” Error message

    “Run-time error ‘1004’:
    Application-defined or object-defined error”

    Thanks ahead of time!

    Joe
    Last edited by JoeSkittles; 04-01-2013 at 08:38 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