Results 1 to 5 of 5

Thread: Suppress Row in Excel based on a condition

  1. #1

    Thread Starter
    Frenzied Member TheBionicOrange's Avatar
    Join Date
    Apr 2001
    Location
    Cardiff, UK
    Posts
    1,818

    Resolved 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 ?
    Last edited by TheBionicOrange; Jun 27th, 2006 at 02:28 AM.

  2. #2
    Lively Member
    Join Date
    Feb 2006
    Posts
    96

    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...

  3. #3
    PowerPoster
    Join Date
    Dec 2004
    Posts
    25,618

    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

  4. #4
    Frenzied Member DKenny's Avatar
    Join Date
    Sep 2005
    Location
    on the good ship oblivion..
    Posts
    1,171

    Re: Suppress Row in Excel based on a condition

    Autofiltering is the way to go.
    VB Code:
    1. Private Sub CheckBox1_Click()
    2.    
    3.     If CheckBox1 Then
    4.         ActiveSheet.AutoFilterMode = False
    5.         ActiveSheet.Range("F1").AutoFilter Field:=6, Criteria1:="Y"
    6.     Else
    7.         ActiveSheet.AutoFilterMode = False
    8.     End If
    9.        
    10. End Sub
    Declan

    Don't forget to mark your Thread as resolved.
    Take a moment to rate posts that you think are helpful

  5. #5

    Thread Starter
    Frenzied Member TheBionicOrange's Avatar
    Join Date
    Apr 2001
    Location
    Cardiff, UK
    Posts
    1,818

    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width