Results 1 to 8 of 8

Hide columns based on cell value - Unable to set hidden range property of Range Class

Threaded View

trillium Hide columns based on cell... 05-12-2012, 02:27 PM
JieJenn Re: Hide columns based on... 05-12-2012, 02:33 PM
trillium Re: Hide columns based on... 05-12-2012, 02:45 PM
JieJenn Re: Hide columns based on... 05-12-2012, 04:27 PM
trillium Re: Hide columns based on... 05-12-2012, 06:59 PM
JieJenn Re: Hide columns based on... 05-12-2012, 07:06 PM
trillium Re: Hide columns based on... 05-12-2012, 07:24 PM
trillium Re: Hide columns based on... 05-13-2012, 11:13 PM
  1. #1
    Registered User
    Join Date
    08-08-2010
    Location
    Ottawa, Canada
    MS-Off Ver
    Excel 2010
    Posts
    85

    Question Hide columns based on cell value - Unable to set hidden range property of Range Class

    test.xlsmHi

    I'm trying to write a very simple code (not using case select) to unhide columns based on variable entered into cell C5. (It's a number from 1 - 12 to represent a month)

    I tried using offset columns based on the month entered (so... if month is March (3)... ) but I'm getting a error message that I can't figure out....

    "Unable to set hidden range property of Range Class"... help?!

    Sub RunningAverageQualityScore()
    
    Dim iMonth As Integer 'review month
    Dim FinalColumn As Integer 'end of chart
    Dim FirstColumn As Integer 'beginning of chart
    Dim ColumnsHide As Integer 'counts columns to hide
    
    
    FinalColumn = Range("FinalColumn").Select
    FirstColumn = Range("FirstColumn").Select
    iMonth = Range("C5").Value
    ColumnsHide = -12 + iMonth
    
    Range("FinalColumn").Offset(0, ColumnsHide).Hidden = True
    
    
    
    End Sub
    Last edited by trillium; 05-12-2012 at 06:58 PM. Reason: add spreadsheet

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