Suppress Row in Excel based on a condition
If I had 10 rows of data, and say Column F had either "Y" or "N" in it, what would be the best way to toggle whether I saw rows with a "Y" in that column or not ?
At the moment I have a checkbox, and if its selected I am reading the value of that column a row at a time using the Offset command, and I am now looking for some kind of row suppress command. I suppose I could just set the RowHeight property to 0.
Is this the best way to do this ?
I know reading row by row and using the offset command can be quite slow, and I don't know the volume of data I will be dealing with yet.
Any suggestions ?
Re: Suppress Row in Excel based on a condition
I'm not quite sure what it is you want to do, but it sounds like attaching a autofilter to a checkbox change command could solve it...
Re: Suppress Row in Excel based on a condition
you can just hide a row, based on the value in a cell in the row
pete
Re: Suppress Row in Excel based on a condition
Autofiltering is the way to go.
VB Code:
Private Sub CheckBox1_Click()
If CheckBox1 Then
ActiveSheet.AutoFilterMode = False
ActiveSheet.Range("F1").AutoFilter Field:=6, Criteria1:="Y"
Else
ActiveSheet.AutoFilterMode = False
End If
End Sub
Re: Suppress Row in Excel based on a condition
OK ... I'll go for filtering.
I've done it now ... but filtering would be neater.
Cheers guys.