Wednesday 6 June 2018

microsoft excel - VBA Hide Rows that contain N/A

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

enter image description here

No comments:

Post a Comment

Where does Skype save my contact's avatars in Linux?

I'm using Skype on Linux. Where can I find images cached by skype of my contact's avatars? Answer I wanted to get those Skype avat...