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
: 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
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).
Klaus Salger phone : +49 (0)89 5902 -502
Zoologisches Institut FAX : -450
AG Wetterauer e-mail: salger at zi.biologie.uni-muenchen.de