+ Reply to Thread
Results 1 to 4 of 4

Unable to set the Hidden property of the Range class

  1. #1
    Registered User
    Join Date
    10-19-2005
    Posts
    45

    Unable to set the Hidden property of the Range class

    Hi all,

    I have set up a userform that is used to format a report to show only the reporting period selected. Basically hiding and unhiding columns along witha bit of formatting etc.

    The macro was working fine but I have had to make changes recently and I am now getting this error on the line highlighted red in the code below:

    Run-Time error '1004':
    Unable to set the Hidden property of the Range class


    Sub MarchReport()

    Sheets("Data").Select

    Range("B6:CN6").Select
    With Selection
    .MergeCells = False
    End With

    August1
    September1
    October1
    November1
    December1
    January1
    February1
    March1
    March
    April
    May

    Columns("H:CO").Select
    Selection.EntireColumn.Hidden = False
    Range("I:AX,AZ:AZ").Select
    Range("AZ1").Activate
    ActiveWindow.SmallScroll ToRight:=9
    Range("I:AX,AZ:AZ,BE:BE,BG:BG,BL:BL,BN:BN").Select
    Range("BN1").Activate
    ActiveWindow.SmallScroll ToRight:=8
    Range("I:AX,AZ:AZ,BE:BE,BG:BG,BL:BL,BN:BN,BS:CN").Select
    Selection.EntireColumn.Hidden = True

    Range("B6:CN6").Select
    With Selection
    .MergeCells = True
    End With

    End Sub

    Can someone please help me?

    cheers,
    Pedros.

  2. #2
    Forum Contributor
    Join Date
    03-13-2005
    Posts
    6,195
    Quote Originally Posted by Pedros
    Hi all,

    I have set up a userform that is used to format a report to show only the reporting period selected. Basically hiding and unhiding columns along witha bit of formatting etc.

    The macro was working fine but I have had to make changes recently and I am now getting this error on the line highlighted red in the code below:

    Run-Time error '1004':
    Unable to set the Hidden property of the Range class[CODE]
    Sub MarchReport()

    Sheets("Data").Select

    Range("B6:CN6").Select
    With Selection
    .MergeCells = False
    End With

    August1
    September1
    October1
    November1
    December1
    January1
    February1
    March1
    March
    April
    May


    Columns("H:CO").Select
    Selection.EntireColumn.Hidden = False
    Range("I:AX,AZ:AZ").Select
    Range("AZ1").Activate
    ActiveWindow.SmallScroll ToRight:=9
    Range("I:AX,AZ:AZ,BE:BE,BG:BG,BL:BL,BN:BN").Select
    Range("BN1").Activate
    ActiveWindow.SmallScroll ToRight:=8

    Range("I:AX,AZ:AZ,BE:BE,BG:BG,BL:BL,BN:BN,BS:CN").Select
    Selection.EntireColumn.Hidden = True

    Range("B6:CN6").Select
    With Selection
    .MergeCells = True
    End With

    End Sub

    Can someone please help me?

    cheers,
    Pedros.
    Hi,

    I cannot see a purpose for the code in red, perhaps this came from a Record Macro, however the following line has the full selection.

    The blue 'Merge Cells' would appear to be only used to drop values between C6 and CN6

    There is no indication what the subroutines are doing, for a test you could comment them out and try the code again.

    If the sub works with the gray items commented out then you need to examine the 'September1' etc routines to see what they do.

    hth
    ---
    Last edited by Bryan Hessey; 01-29-2007 at 08:08 PM.
    Si fractum non sit, noli id reficere.

  3. #3
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,259
    Hello Pedros,

    If you are trying to hide all the Columns in the Range statement...

    Range("I:AX,AZ:AZ,BE:BE,BG:BG,BL:BL,BN:BN,BS:CN"). Select

    you can use this method...

    Please Login or Register  to view this content.
    Sincerely,
    Leith Ross

  4. #4
    Registered User
    Join Date
    10-19-2005
    Posts
    45
    thanks Leith,

    that was exactly what I required, much appreciated!!!

    Cheers,

    Pedros.

+ 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