I formulated a financial statement importing information from an external SQL based accounting software. The numbers spit out into excel and I have modified the sheet to look presentable. We occasionally have zero values, but want to hide those rows if they are zero. There are also titles that need to be hidden, and those columns after the titles have blank values. I have a VBA for the whole worksheet that hides rows with zero balances. I need a VBA that hides rows that contain text in one column AND zero or blank in another column.
I don't know or write macros. The macro I have is copied and pasted, and modified to fit my data set. The columns I need the macro to read are columns C and D rows 20:200.
Here is my current VBA:
Sub SelectionHide()
Dim xSh As Worksheet
Application.ScreenUpdating = False
For Each xSh In Worksheets
xSh.Select
Call RunCode
Next
Application.ScreenUpdating = True
End Sub
Sub RunCode()
Application.ScreenUpdating = False
Application.Calculation = xlManual
Rows("20:300").Hidden = False
For Each c In Range("D20:D300")
If c.Value = 0 And c.Value <> "" And c.Offset(0, "1.8").Value = 0 And c.Offset(0, "1.8").Value <> "" Then Rows(c.Row).Hidden = True
Next c
Application.Calculation = xlAutomatic
Application.ScreenUpdating = True
End Sub
I don't know or write macros. The macro I have is copied and pasted, and modified to fit my data set. The columns I need the macro to read are columns C and D rows 20:200.
Here is my current VBA:
Sub SelectionHide()
Dim xSh As Worksheet
Application.ScreenUpdating = False
For Each xSh In Worksheets
xSh.Select
Call RunCode
Next
Application.ScreenUpdating = True
End Sub
Sub RunCode()
Application.ScreenUpdating = False
Application.Calculation = xlManual
Rows("20:300").Hidden = False
For Each c In Range("D20:D300")
If c.Value = 0 And c.Value <> "" And c.Offset(0, "1.8").Value = 0 And c.Offset(0, "1.8").Value <> "" Then Rows(c.Row).Hidden = True
Next c
Application.Calculation = xlAutomatic
Application.ScreenUpdating = True
End Sub