LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 12
Default Enabling option „Format rows“ to hide/unhide rows using VBA-code?

I have used the code below, which is tied to a multi-drop-down-list
in
order to unhide/hide rows (unhiding rows = yes = 1, hiding rows = no =
2.

The macro works fine, unless the worksheet is being protected. I then
get a runtime-error 1004, saying the hidden property of the range
object cannot be determined (Code-Line 8).
S.o. (Luke M) suggested that I need to have the option of "Format
rows" enabled, or I can't hide/unhide rows. The respective VBA-Code
suggestion was:
ActiveSheet.Protect DrawingObjects:=True, Contents:=True,
Scenarios:=True _
, AllowFormattingRows:=True

Can s.o. help me integrating the above-mentioned code into below-
mentioned code?
Unfortunately I have only little knowledge in VBA.... Many many
thanks!
Sub HideRows()
Dim Rng As Range
Set Rng = Sheets("Ziel1").Range("K6")
If Rng.Value = 1 Then
Rows("7:19").EntireRow.Hidden = False
Range("K6").Select
ElseIf Rng.Value = 2 Then
Rows("7:19").EntireRow.Hidden = True
End If
 
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
How to Hide and Unhide Rows Jonno Excel Discussion (Misc queries) 2 June 9th 09 04:34 PM
VB Code to hide and unhide rows Raj Excel Discussion (Misc queries) 2 February 27th 08 05:58 AM
Code for button to hide/unhide rows Chris Excel Worksheet Functions 5 March 5th 07 06:15 AM
Hide Unhide Rows blackstar Excel Discussion (Misc queries) 2 February 6th 06 09:36 PM
Checkbox to hide and unhide rows Please. Steved Excel Worksheet Functions 2 December 6th 04 11:30 PM


All times are GMT +1. The time now is 01:46 AM.

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"