Hi all
I have a sheet in which in coloumn Q i have either an "X" in it or the cell is empty. I would like to code that when i execute it all the rows which have an "X" in the according cell are hidden. I coded it like this, it's working but it is very clumsy, bascially I would end up having a code line for every row in the sheet :-( Can somebody help please. Thanks so much.
Sub rows_theta_grafik()
Cells(1, 17).Activate
If Cells(1, 17) = "X" Then
Selection.EntireRow.Hidden = True
End If
Cells(2, 17).Activate
If Cells(2, 17) = "X" Then
Selection.EntireRow.Hidden = True
End If
Cells(3, 17).Activate
If Cells(3, 17) = "X" Then
Selection.EntireRow.Hidden = True
End If
Cells(4, 17).Activate
If Cells(4, 17) = "X" Then
Selection.EntireRow.Hidden = True
End If
Cells(5, 17).Activate
If Cells(5, 17) = "X" Then
Selection.EntireRow.Hidden = True
End If
Cells(6, 17).Activate
If Cells(6, 17) = "X" Then
Selection.EntireRow.Hidden = True
End If
Range("F9").Select
End Sub
I have a sheet in which in coloumn Q i have either an "X" in it or the cell is empty. I would like to code that when i execute it all the rows which have an "X" in the according cell are hidden. I coded it like this, it's working but it is very clumsy, bascially I would end up having a code line for every row in the sheet :-( Can somebody help please. Thanks so much.
Sub rows_theta_grafik()
Cells(1, 17).Activate
If Cells(1, 17) = "X" Then
Selection.EntireRow.Hidden = True
End If
Cells(2, 17).Activate
If Cells(2, 17) = "X" Then
Selection.EntireRow.Hidden = True
End If
Cells(3, 17).Activate
If Cells(3, 17) = "X" Then
Selection.EntireRow.Hidden = True
End If
Cells(4, 17).Activate
If Cells(4, 17) = "X" Then
Selection.EntireRow.Hidden = True
End If
Cells(5, 17).Activate
If Cells(5, 17) = "X" Then
Selection.EntireRow.Hidden = True
End If
Cells(6, 17).Activate
If Cells(6, 17) = "X" Then
Selection.EntireRow.Hidden = True
End If
Range("F9").Select
End Sub