LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 397
Default 1004- Unable to set the hidden property of the range class

Hi there,

I have a macro that looks at columns in a workbook, and if the colour in
line 189 matches the colour of the cell when the macro is run it leaves
the column visible. If the colour is different it hides the column.

It works perfectly up until about 5 minutes ago, when I get the subject
title error - It also works from column F until column GW - and then
gets stuck. Im no expert... so appreciate any advice.
The Macro that runs the colour hiding / not is shown below

Any ideas...??

Apprecaite the help....!!!

Kind Regards

D


Public Sub Colour_views()

Dim objWS As Excel.Worksheet
Dim objCell As Excel.Range, objR As Excel.Range
Dim i As Byte
Dim J As Long

Set objWS = Sheets("Master")
' Don't forget that wherever you're looking at, the selected cell needs
to have a background
' color that matches the various "views" you've built on the master
sheet.

Set objCell = Application.Selection

J = objCell.Interior.ColorIndex

' Hide columns
' If columns A - F are always going to be there, we only need to start
with Column E, which
' is column number 6.
For i = 6 To 223

Set objR = objWS.Cells(2, i) ' We'll always be looking at row 2 -
the column will change
If objR.Interior.ColorIndex < J Then

objWS.Columns(i).Hidden = True

End If

Next

Set objR = Nothing
Set objCell = Nothing
Set objWS = Nothing

Sheets("master").Select
End Sub


*** Sent via Developersdex http://www.developersdex.com ***
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Error 1004 - unable to set the hastitle property of the axis class Henri Excel Programming 14 November 18th 07 04:21 PM
Hiding Rows Error - "Runtime Error 1004 - Unable to set the hidden property of the range class" Punsterr Excel Programming 2 April 9th 07 05:32 PM
1004 - Unable to set the hidden property of the range class Tim Whitley Excel Programming 3 February 20th 06 09:50 PM
Run time error 1004 - Unable to get add property of the buttons class Mark[_37_] Excel Programming 0 March 1st 04 09:48 AM
Runtime 1004 unable to get find property of range class Eric Excel Programming 2 January 30th 04 01:06 PM


All times are GMT +1. The time now is 05:00 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"