Automatic Hide/Unhide Programming

C

corey.helms

I'm wanting to create conditional formatting such that when users
submit info in one cell, a previously hidden row underneath it becomes
unhidden and available for formatting. Is there a way to do that?
=====================================================
On May 20, 2:53 pm, Gord Dibben <gorddibbATshawDOTca> wrote:
Not using Conditional Formatting.
You would need event code to achieve the unhiding of a row.

Private Sub Worksheet_Change(ByVal Target As Range)
If Intersect(Target, Me.Range("A1")) Is Nothing Then Exit Sub
On Error GoTo endit
Application.EnableEvents = False
If Target.Value <> "" Then
Rows("2:2").EntireRow.Hidden = False
End If
endit:
Application.EnableEvents = True
End Sub

This is sheet event code. Right-click on the sheet tab and "View
Code".

Paste the code into that module. Edit to suit then Alt + q to return
to the Excel window.

Gord Dibben MS Excel MVP
=====================================================
I'm relatively new to VBA, what exactly should I be looking to edit?
=====================================================
I used A1 as the input cell and row 2 as the row to unhide.

You would have to edit those to suit.

Would you be wanting this for more than a single cell or single row?

Post some details.......cell references and row numbers.

Gord
=====================================================
Essentially, I'm creating a sheet that contains three categories of
employees. Under each of these categories, I have as many rows as
there are people in that particular category. By default, no
employees names are chosen. The first column contains data
validation
lists containing all employees in each category. What I'm wanting to
have happen is when a user chooses someone from the list on the first
row, the next row becomes available for selection. I'd like for it
to
continue down the list, until it reaches the end of each category.

For instance, B4 is the first blank cell. When an employee is chosen
for cell B4, I want row 5 to become available. When B5 is chosen,
row
6 opens, etc. Each category ideally would only contain 45-50 names.


Thanks again for all the help!
 
P

Patrick Molloy

not really formatting
you can use the CHANGE event to unhide a row beneath the changed cell ...
Gord's code did that

you might add

Rows("2:2")..RowHeight = 13.5

in case this went to zero
]

I'm wanting to create conditional formatting such that when users
submit info in one cell, a previously hidden row underneath it becomes
unhidden and available for formatting. Is there a way to do that?
=====================================================
On May 20, 2:53 pm, Gord Dibben <gorddibbATshawDOTca> wrote:
Not using Conditional Formatting.
You would need event code to achieve the unhiding of a row.

Private Sub Worksheet_Change(ByVal Target As Range)
If Intersect(Target, Me.Range("A1")) Is Nothing Then Exit Sub
On Error GoTo endit
Application.EnableEvents = False
If Target.Value <> "" Then
Rows("2:2").EntireRow.Hidden = False
Rows("2:2")..RowHeight = 13.5 ' ***** HERE <<================
 

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