Hiding Rows Based on CheckBox On or Off
Klaus Salger
salger at wap1.zi.biologie.uni-muenchen.de
Thu May 8 22:17:57 EST 1997
Don (dbranth at mindspring.com) wrote:
: I am using Excel 5/7
: I have a spreadsheet called Sheet1 and a Dialog Box (Dialog1). The
: Dialog Box has 20 CheckBoxes on it
: When a user Checks a CheckBox, I would like the Corresponding Row to
: be visible. If it is unchecked, then I would like the row to be
: unhidden.
: I can do it individually, but have real trouble when it comes to
: looping through.
: Here is my code that is not quite there:
: Dialog1 and Sheet1 have been defined and Set
: For k = 1 To 20
: If Dialog1.CheckBoxes(k) = xlOff Then
: Sheet1.Rows("k:k").EntireRow.Hidden = False
:
: ElseIf Dialog1.CheckBoxes(k) = xlOn Then
: Sheet1.Rows("k:k").EntireRow.Hidden = True
:
: End If
: Next k
Don,
this doesn't work because you put the variable k in quotation marks which
prevents it from beeing evaluated (and there is no row "k").
Just replace ("k:k") by (k & ":" & k).
Cheers
Klaus
--
Klaus Salger phone : +49 (0)89 5902 -502
Zoologisches Institut FAX : -450
AG Wetterauer e-mail: salger at zi.biologie.uni-muenchen.de
Luisenstr. 14
80333 Muenchen
Germany
BioLinks: http://www.zi.biologie.uni-muenchen.de/~salger/salger.html
More information about the Bio-soft
mailing list