Macro to Hide Rows

N

New2Macros

I'm using the following macro to hide/show rows, but I get a "run-time error
'1004' Unable to set the Hidden property of the Range Class" if the row
contains a combo box. The combo boxes are inserting information into
adjoining cells on the same row. What could be causing the error?

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "$A$2" Then
Range("2:" & Rows.Count).EntireRow.Hidden = False
Range(CStr(3 + 2 * Range("A2").Value) & ":" & _
Rows.Count).EntireRow.Hidden = True
End If
End Sub
 
S

Susan

the error is that there's a combobox in the way & it won't let you
programatically hide the row. there's nothing wrong with the sub
(that i can see).
you'll have to skip the row if it contains a combobox.
hth
susan
 
N

New2Macros

That will cause a problem, because I need a combo box on every row. Is there
a way to get around this?
 
S

Susan

i don't know; maybe someone else can help.
susan

That will cause a problem, because I need a combo box on every row.  Is there
a way to get around this?






- Show quoted text -
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top