Hide rows with 0 value in cell (temporary)

cripopes

New Member
Joined
Apr 4, 2021
Messages
10
Office Version
  1. 365
Platform
  1. Windows
Hello again gents,

I have a work project which is way over my excell modest skills. I have a large list of products and some have values and some have 0 value for now. To sort out this list for more efficiency I'm looking to temporarily hide those until I need them, eventually with a button or something. Below you have the file.

Untitled.jpg


So if the value in row 'D' is 0 for that column to hide it completely but need an option to unhide them later - a button to hide - unhide will be awesome or any other option for this matter.

Help highly appreciated.

C
 

Excel Facts

Create a chart in one keystroke
Select the data and press Alt+F1 to insert a default chart. You can change the default chart to any chart type

My Aswer Is This

Well-known Member
Joined
Jul 5, 2014
Messages
18,163
Office Version
  1. 2013
Platform
  1. Windows
You said:
So if the value in row 'D' is 0

I assume you mean column D
Are you wanting to hide or unhide all of them at once if they have a 0 or just certain rows with 0 in column D

Are these zeros manually entered of the result of a formula?
 

cripopes

New Member
Joined
Apr 4, 2021
Messages
10
Office Version
  1. 365
Platform
  1. Windows
Yes, all of them at once which D have a zero. And yes, it's a result of a macro.

VBA Code:
Private Sub Worksheet_Change(ByVal Target As Range)
Dim newVal As Long, oldVal As Long
    If Target.Column = 2 Then
        'new val
        newVal = Target.Value
        Application.EnableEvents = False
        Application.Undo
         oldVal = Range("D" & Target.Row).Value
        Range("D" & Target.Row).Value = oldVal + newVal
        Target.Value = newVal
        Application.EnableEvents = True
    End If
    If Target.Column = 3 Then
        'new val
        newVal = Target.Value
        Application.EnableEvents = False
        Application.Undo
         oldVal = Range("D" & Target.Row).Value
        Range("D" & Target.Row).Value = oldVal - newVal
        Target.Value = newVal
        Application.EnableEvents = True
    End If
End Sub
 

Forum statistics

Threads
1,148,327
Messages
5,746,128
Members
423,994
Latest member
blzxatly

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top