I have an excel file that has dynamic data that changes daily. For example, a user will populate data on the data tab and the percentages are calculated using an "if Command" if there isnt any data N/A is populated in the cell. (screenshot) I'd like to add a macro that will hide any rows that contain cells with N/A This is what I am using and I either delete the rows or it hides all rows. Depending on the value I set. "N" removes all rows N/A doesn't do anything. I have checked other examples but i couldnt get any others to work.
Thank you in advance!
Sub HideRows()
BeginRow = 9
EndRow = 50
ChkCol = 20
For RowCnt = BeginRow To EndRow
If Cells(RowCnt, ChkCol).Value = "N/A" Then
Cells(RowCnt, ChkCol).EntireRow.Hidden = True
Else
Cells(RowCnt, ChkCol).EntireRow.Hidden = False
End If
Next RowCnt
End Sub
No comments:
Post a Comment