Hiding Rows Based on CheckBox On or Off

Don dbranth at mindspring.com
Thu May 8 01:50:30 EST 1997


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

=====================================================
Also, - I have some code that works great for EditBoxes thanks to
Jennifer Campion, but I have not been able to get it to work for
DropDowns. Here is the code

Dialog2 has been defined and set

Dim i As Integer,  Dim j As Integer, Dim Value5 As Integer
    
    Value5 = Dialog2.EditBoxes("InitialEditBox").Text
    For i = 1 To Dialog2.EditBoxes.Count
        Dialog2.EditBoxes(i).Visible = True
       Dialog2.DropDowns(i).Visible = True       'does not work
    Next i
    
    
        
    For j= 1 To Dialog2.EditBoxes.Count
       Dialog2.EditBoxes(j).Visible = False
       Dialog2.DropDowns(j).Visible = False       'does not work
    Next j
     
       ExpensesStep5.EditBoxes("InitialEditBox").Visible = True


I am not sure why either of the two things do not work, but I would
appreciate any help.

Thanks in advance (once again and again)

Don





More information about the Bio-soft mailing list