View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Johanna Gronlund Johanna Gronlund is offline
external usenet poster
 
Posts: 32
Default Hiding and unhiding rows

Thanks, that worked really well! I am very pleased!

However, now that I have shared it with other people they would like to have
it looking better visually. They would like to have a combobox where they can
select the values from. Is this possible? I have managed to create a combobox
which excel has named 'dropdown91' but was unable to modify the macro to take
the values from that box.

Many thanks again!

--
Johanna G


"Jacob Skaria" wrote:

Select the sheet tab which you want to work with. Right click the sheet tab
and click on 'View Code'. This will launch VBE. Paste the below code to the
right blank portion. Get back to to workbook and try out.

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "$D$30" Then
UsedRange.EntireRow.Hidden = False
If Target.Value = 2 Then Range("A51:A61").EntireRow.Hidden = True
If Target.Value = 3 Then Range("A32:A52").EntireRow.Hidden = True
End If
End Sub

--
Jacob


"Johanna Gronlund" wrote:

Hello,

I have been trying to work out how to do this by reading previous posts but
this has defeated me.

I have a sheet called 'inputs'. Based on a value on a cell D30, I want to
hide/unhide rows. The possible values for D30 are 1, 2 or 3.

If cell value is 1, I want to show all rows

If cell value is 2, I want to hide rows 51-61 and show all others, including
32-52 if value 3 has previously been selected.

If cell value is 3, I want to hide rows 32-52 and show all others, including
51-61 if value 2 has previously been selected.

If there is anyone who knows how to do this, please help. Or if this is just
not do-able (for someone with my skills), that would be helpful to know as
well.

Many thanks if advance!

--

Johanna