VBA To Hide a Row based upon a formula result

Microsoft Excel 2003 (full product)
August 6, 2010 at 13:04:22
Specs: Windows XP

I am looking for help to right a Macro that will look at a cell containing a formula to determine its result and hide the row if the result is say = to 0. The result can change so I expect that if it changes and I refresh the macro the row will return. Thank you

See More: VBA To Hide a Row based upon a formula result

August 6, 2010 at 18:28:01

1. Post the macro
2. How do you refresh the macro
3. What formula is in the cell
4. What happens now - what results do you get
5. You say the result is say = to 0
but what is the real result that you are looking for and which causes a row to be hidden - post the real value
... Then we might be able to suggest a solution


Report •

August 9, 2010 at 12:49:03
Hi Humar,

1.) Private Sub CommandButton3_click()

BeginRow = 10
EndRow = 37
ChkCol = 5

For RowCnt = BeginRow To EndRow
If Cells(RowCnt, ChkCol).Value = "Not Applicable" Then
Cells(RowCnt, ChkCol).EntireRow.Hidden = True
Cells(RowCnt, ChkCol).EntireRow.Hidden = False
End If
Next RowCnt

End Sub

2.) I have a command button on the spreadsheet that states refresh data.
3.)=INDEX(Material_Numbers,Sheet1!V2), I am creating a selection sheet where the user will identify parts requirements for different parts of their system. In this case I am asking the user how may of a type of material they need, then the user identifys the model they need. Once the selection is made the spreadsheet with the above code is making a Bill of Materials based on the Models that have been chosen. I have 8 list boxes for 1 section but if the user only needs 2 I don't want to show 6 extra rows that the part number is not applicable.
4.) When I click the refresh data button it appears that the macro runs and reviews the data but nothing changes.
5.) The real value is Not Applicable

Thank you

Report •
Related Solutions

Ask Question