Q:

Un-hiding rows depending on two values

I wrote VBA code to hide the rows in my chart where in the cell of column G the value "XYZ" occurs.  
i = 4 ' row to begin with
j = Cells(i, 7).End(xlDown).Row
clmn = 7 ' column G
mark = False
For row = j To i Step -1
If (Cells(row, clmn).Value = "XYZ") Then
If mark Then
Union(Selection, Rows(row)).Select
Else
Rows(row).Select
mark = True
End If
End If
Next row
Selection.EntireRow.Hidden = True

This works totally fine. Now after working in this modifies chart I'd like to add a second attaching VBA code so that all the hidden rows with "XYZ" in column G reappear BUT only if in column A of the same row there stands "ABC". So not all of the hidden rows should unhide. 
How do I have to modify my own code to have this done?

A:

As Redji comment, just add a condition to your If clause. anyway, I don't prefer using the union and select approach. 
If Cells(row, clmn).Value = "XYZ" and  _
   Cells(row, 1).Value = "ABC" Then
   ' do the selection if you like
Selection.EntireRow.Hidden = false

you also can use the specialcells as well. for instance, if your range is A4:G & j you can address this code in your chart. 
range("a4:g" & j).Rows.SpecialCells(xlCellTypeVisible)

Regards,
M

