Share via

Hide/Select rows using combo box

Anonymous
2013-06-04T08:51:43+00:00

I am trying to write vba code that will hide selected rows and show other rows based on the selection of a combo box.  This could be done in excel 97 but I am struggling in 2010 version.  Thanks

Microsoft 365 and Office | Excel | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

Answer accepted by question author

Anonymous
2013-06-04T12:42:03+00:00

Hi,

try this sample,

(hide rows, from row 3 up to row 20, under conditions)

  1. linked cell is A1
  2. input range say, A22:A27 (a,b,c,d,e,f,g)
  3. assign macro is..

Sub macro_01()

Set rng = Range("A3:A20")

rng.EntireRow.Hidden = False

Select Case Range("A1")

Case Is = "1"

Range("A3:A8").EntireRow.Hidden = True

Case Is = "2"

Range("A9:A14").EntireRow.Hidden = True

Case Is = "3"

Range("A15:A20").EntireRow.Hidden = True

Case Else

rng.EntireRow.Hidden = False

End Select

End Sub

XXXXXXXXXXXXXXXXXXXX

another approach,

instead of ComboBox, you might use

a cell as drop down menu list

and..

replace, the macro (in regular module)

with

a Private Sub Change event

Was this answer helpful?

0 comments No comments

0 additional answers

Sort by: Most helpful