Forum Discussion
Sparke0930
Dec 22, 2018Copper Contributor
I need to write a Macro that when run will hide rows
I am creating an order form for a small business. The form has all of the items available to purchase. When an employee works on an order for a customer, they will put a quantity in the "Quantity" ...
Dec 23, 2018
Hi,
I have non-macro solution for your, I would suggest you convert that entry data into Excel Tables & insert the slicer for qty. When generating invoice select all and once you are done with your entry filter out the qty 0 unselect it.
Hope you find this solution helpful and easy.
Regards, Faraz Shaikh
JWR1138
Dec 31, 2018Iron Contributor
Hi, If you are still looking for a VBA solution, just change "For i = 17 To 27" to the appropriate row numbers for your range that you want to hide row with a 0 in column J.
Sub HideRows()
Dim i As Integer
For i = 17 To 27
If Cells(i, 10).Value = 0 Then
Rows(i).EntireRow.Hidden = True
End If
Next i
End Sub
Sub UnHideRows()
Rows.EntireRow.Hidden = False
End Sub