Excel Run-time Error 1004 Unable To Set The Hidden Property
Contents |
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies excel run time error 1004 application defined or object defined error of this site About Us Learn more about Stack Overflow the company excel run time error 1004 general odbc error Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users excel run time error 1004 select method of range class failed Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a excel run time error 1004 method saveas of object _workbook failed minute: Sign up Unable to set the hidden property of the range class run time error '1003' up vote 0 down vote favorite I have code in this module: Sub HideSalTable() User = Worksheets("log").Range("R1").Value If User = ThisWorkbook.Worksheets("SSSSSS").Range("za1").Value Then Columns("S:AA").EntireColumn.Hidden = True ElseIf User = ThisWorkbook.Worksheets("SSSSSS").Range("za3").Value Then Columns("S:AA").EntireColumn.Hidden = False ElseIf User = ThisWorkbook.Worksheets("SSSSSS").Range("za4").Value Then Columns("S:AA").EntireColumn.Hidden = False End If End Sub
Excel Run Time Error 1004 Select Method Of Worksheet Class Failed
I have a button to redirect me to ThisWorkbook.Worksheets("SSSSSS") with this code: Private Sub Change_SSSSSS_Button_Click() Dim pass1 As String Dim pass2 As String pass1 = ThisWorkbook.Worksheets("SSSSSS").Range("za3").Value pass2 = ThisWorkbook.Worksheets("SSSSSS").Range("za4").Value Dim Inp Dim lTries As Long lTries = 1 Do Inp = InputBoxDK("enter password", "Zmhnk") If Inp = "" Or Inp = vbCancel Then Exit Sub '* Cancel button pressed or nothing entered If Inp = (pass1) Or Inp = (pass2) Then Exit Do End If lTries = lTries + 1 If lTries > 4 Then MsgBox "Error", vbInformation, "Zmhnk" Exit Sub Else If MsgBox("try again", vbYesNo, "error_Zmhnk") = vbNo Then Exit Sub End If Loop Application.ScreenUpdating = False Sheets("SSSSSS").Visible = True Sheets("SSSSSS").Activate Application.ScreenUpdating = True End Sub The problem is when the user presses the button with the 2nd code I face an error and I don't know why. The error: Unable to set the hidden property of the range class run time error '1003' excel-vba share|improve this question edited Sep 5 '12 at 3:46 chembrad 54931126 asked Sep 5 '12 at 3:31 Zaid Kalthoum 1125 add a comment| 1 Answer 1 a
Forums Excel Questions Run Time Error '1004 when hiding rows? Results 1 to 9 of 9 Run Time Error '1004 when hiding rows?This is a discussion on
Excel Run Time Error 1004 Method Range Of Object _worksheet Failed
Run Time Error '1004 when hiding rows? within the Excel Questions forums, part excel run time error 1004 method range of object _global failed of the Question Forums category; I'm not sure why this is happening, but it is a simple code: If run time error 1004 excel macro Sheets("Data").Range("I54").Value = "Quarter End" Then Exit ... LinkBack LinkBack URL About LinkBacks Bookmark & Share Digg this Thread!Add Thread to del.icio.usBookmark in TechnoratiTweet this thread Thread Tools Show Printable Version http://stackoverflow.com/questions/12274131/unable-to-set-the-hidden-property-of-the-range-class-run-time-error-1003 Display Linear Mode Switch to Hybrid Mode Switch to Threaded Mode Oct 3rd, 2003,08:05 AM #1 gottimd Board Regular Join Date Jul 2002 Posts 501 Run Time Error '1004 when hiding rows? I'm not sure why this is happening, but it is a simple code: If Sheets("Data").Range("I54").Value = "Quarter End" Then Exit Sub Application.ScreenUpdating = False Rows("32:51").Select Range("B32").Activate Selection.EntireRow.Hidden = False Rows("33:46").Select Range("B33").Activate Selection.EntireRow.Hidden http://www.mrexcel.com/forum/excel-questions/62649-run-time-error-1004-when-hiding-rows.html = True Rows("49:50").Select Range("B49").Activate Selection.EntireRow.Hidden = True Range("E17").Select Application.ScreenUpdating = True But the Run Time Error keeps coming up, "Unable to set the hidden property of the Range Class". What am I doing wrong? It is stopping on the bolded line above. Is it because the lines are already shown? Is there a way to write an If Statement around that, as in if they are already shown, then go to the next command? Share Share this post on Digg Del.icio.us Technorati Twitter Reply With Quote Oct 3rd, 2003,08:13 AM #2 Mudface MrExcel MVP Join Date Feb 2002 Location Sunny, spring-like Hull Posts 3,339 Re: Run Time Error '1004 when hiding rows? Is your sheet protcted, perhaps? If not, then this shortened version of your code worked OK for me- Code: If Sheets("Data").Range("I54").Value = "Quarter End" Then Exit Sub Application.ScreenUpdating = False Range("32:51").EntireRow.Hidden = False Union(Range("33:46"), Range("49:50")).EntireRow.Hidden = True Range("E17").Select Application.ScreenUpdating = True Share Share this post on Digg Del.icio.us Technorati Twitter Reply With Quote Oct 3rd, 2003,08:15 AM #3 gottimd Board Regular Join Date Jul 2002 Posts 501 Re: Run Time Error '1004 when hiding rows? I
(עברית)المملكة العربية السعودية (العربية)ไทย (ไทย)대한민국 (한국어)中华人民共和国 (中文)台灣 (中文)日本 (日本語) Home20132010Other VersionsLibraryForumsGallery Ask a question Quick access Forums home Browse forums users FAQ Search related threads Remove From My Forums Answered by: 1004 Unable to GET the Hidden property of the Range class. Microsoft Office > Excel IT Pro Discussions Question 0 Sign in https://social.technet.microsoft.com/Forums/office/en-US/6bbc4724-dc69-4a21-b78d-0a7a15799de8/1004-unable-to-get-the-hidden-property-of-the-range-class?forum=excel to vote I am looking through selection areas (one or more ranges) and I also tried looking at each cell in a range to see if any cells are hidden. In my case, I expect https://answers.yahoo.com/question/?qid=20090528171859AAmHIC6 entire rows to be hidden, but still, they're just subsets of selected areas. No matter if I look at a range or a cell (still a range of one cell) I get Run-time error '1004': error 1004 Unable to GET the Hidden property of the Range class. VBA help says '.Hidden' can be set or it returns a "varient", so I'm just trying to see if anything is hidden. In the spreadsheet I hide column B and C, and then select cells in one row from column A to column F and run the macro and get the 1004error. Even if no columns are hidden I get the time error 1004 same 1004 error. Here is the code snippet: Dim hiddenCellsExist As Variant ' I also tried Boolean to no avail. hiddenCellsExist = False MsgBox "hiddenCellsExist = " & hiddenCellsExist ' This tells me "hiddenCellsExist = False For Each rngPart In Application.Selection.Areas ' MsgBox rngPart.Address ' If I uncomment this it tells me the range. A$119:E$119 if B and C are hidden or not. hiddenCellsExist = rngPart.Hidden ' The 1004 error appears here. MsgBox "hiddenCellsExist = " & hiddenCellsExist ' The code doesn't get here. Exit Sub ' Because I'm testing the code I exit. All the other Q&As are about setting or unsetting the hidden property and most of the solutions are about unprotecting the worksheet/book, but mine is not protected and I'm not setting anything at this part in the code. What am I doing wrong? (I get the same error if I use an inner loop looking at each cell in each range.) Thursday, March 27, 2014 5:14 PM Reply | Quote Answers 0 Sign in to vote If you want to know whether the columns of a range are hidden, you need to specify EntireColumn. If you want to know whether the rows of a range are hidden, you need to specify EntireRow. So use: hiddenCellsExist = rngPart.EntireColu
Help Suggestions Send Feedback Answers Home All Categories Arts & Humanities Beauty & Style Business & Finance Cars & Transportation Computers & Internet Consumer Electronics Dining Out Education & Reference Entertainment & Music Environment Family & Relationships Food & Drink Games & Recreation Health Home & Garden Local Businesses News & Events Pets Politics & Government Pregnancy & Parenting Science & Mathematics Social Science Society & Culture Sports Travel Yahoo Products International Argentina Australia Brazil Canada France Germany India Indonesia Italy Malaysia Mexico New Zealand Philippines Quebec Singapore Taiwan Hong Kong Spain Thailand UK & Ireland Vietnam Espanol About About Answers Community Guidelines Leaderboard Knowledge Partners Points & Levels Blog Safety Tips Computers & Internet Software Next Excel Error: "Run-time error 1004: Unable to set the Hidden property of the Range class"? I have a worksheet that hides rows when a drop-down selection is made (hides rows if one thing is selected, doesn't if the other is chosen). This works fine on my machine and some other people's (I am running Office 2007 on XP). However, some other people are getting the following error when they select... show more I have a worksheet that hides rows when a drop-down selection is made (hides rows if one thing is selected, doesn't if the other is chosen). This works fine on my machine and some other people's (I am running Office 2007 on XP). However, some other people are getting the following error when they select the dropdown: Run-time error '1004': Unable to set the Hidden property of the Range class". From looking around online, it appears as though the worksheet being protected may have something to do with this. However, I cannot send out this sheet unprotected or people will screw it up (this will pass through many hands). The dropdown cell is not locked even though the sheet is protected. The rows that get hidden, though, are locked although individual cells within those rows are not. Hopefully this makes sense. Finally, my code looks like this: Private Sub Worksheet_Change(ByVal Target As Range) If Target.Address(