Hide/Unhide Help

  • Thread starter Thread starter Danno
  • Start date Start date
D

Danno

I have been through the search on numerious occasions and can't find an
answer. Here is my problem.

I have a sheet for my work load. I want to hide rows that have a blank
cell in colum B when a key is pressed. However, I want the rows to
unhide when the workbook is opened.

Any help would be greatly appreciated.

Thanks,
Danno
 
Hi Danno,

If you have a subroutine that will hide/unhide as needed:

Public Sub ToggleRows(rbHide As Boolean)
Dim rng As Range

Set rng = Sheet1.UsedRange.Columns(2).SpecialCells( _
xlCellTypeBlanks)

If Not rng Is Nothing Then
rng.EntireRow.Hidden = rbHide
End If
End Sub

You can call this with a True argument when hiding the rows with blank col
B. You can call this subroutine with a False argument from the
Workbook_Open event subroutine (double-click ThisWorkbook icon and paste in
the following code):

Private Sub Workbook_Open()
ToggleRows False
End Sub

--
Regards,

Jake Marx
www.longhead.com


[please keep replies in the newsgroup - email address unmonitored]
 
Jake,

Thank you for the reply. I am not sure what I am doing wrong. Kee
getting exictuable errors.

Dann
 
Danno,
Thank you for the reply. I am not sure what I am doing wrong. Keep
getting exictuable errors.

In my example, I used Sheet1 as the worksheet object. You should change
this to Sheets("<yoursheetname>") - other than that, it should work. Can
you post your code and indicate the line that raises the error along with
the error # and description?

--
Regards,

Jake Marx
www.longhead.com


[please keep replies in the newsgroup - email address unmonitored]
 

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

Back
Top