I have a table that pulls data from another range based on a dropdown from another worksheet. I have tried VBA's to clear the blank rows based on a cell value and can't seem to get them to work. (I think it's because of the formula in the cells - {=IFERROR(INDEX(J$20:J$117,SMALL(IF($I$20:$I$117=DWOR!$G$71,IF($I$20:$I$117<>"",ROW(J$20:J$117)-ROW(J$20)+1)),ROWS(J$20:$J20))),"")} )
So instead of doing that, I thought I would try just filtering the blanks out, but I need it to automatically reapply the filter when the table data changes because this worksheet is going to be hidden eventually. I have tried a few different codes but none seem to work. I have never really used VBA as I only started using and learning excel in the last couple months.
1.) Private Sub Worksheet_Change(ByVal Target As Range)
Sheets("Sheet3").AutoFilter.ApplyFilter
End Sub
2.) Sub ReapplyFilter()
ActiveSheet.AutoFilter.ApplyFilter
End Sub
3.) Private Sub Worksheet_Change(ByVal Target As Range)
If Me.FilterMode = True Then
With Application
.EnableEvents = False
.ScreenUpdating = False
End With
With ActiveWorkbook
.CustomViews.Add ViewName:="Mine", RowColSettings:=True
Me.AutoFilterMode = False
.CustomViews("Mine").Show
.CustomViews("Mine").Delete
End With
With Application
.EnableEvents = True
.ScreenUpdating = True
End With
End If
End Sub
This last code, I don't understand any of it, so I can't even edit it to correspond with my own worksheet, if I even have to.
What I am doing is right clicking on my worksheet name, selecting view code, pasting the code in the screen, saving and then going back to excel. Maybe I am putting the codes in wrong, I have no idea.
Does anyone have an idea why these aren't working? My worksheet name is "Downtime Summary Primary HIDE", which I put into the first code. The second code seems pretty straightforward, no editing needed that I can see, yet still doesn't work.
Please help the not so smart newbie.
So instead of doing that, I thought I would try just filtering the blanks out, but I need it to automatically reapply the filter when the table data changes because this worksheet is going to be hidden eventually. I have tried a few different codes but none seem to work. I have never really used VBA as I only started using and learning excel in the last couple months.
1.) Private Sub Worksheet_Change(ByVal Target As Range)
Sheets("Sheet3").AutoFilter.ApplyFilter
End Sub
2.) Sub ReapplyFilter()
ActiveSheet.AutoFilter.ApplyFilter
End Sub
3.) Private Sub Worksheet_Change(ByVal Target As Range)
If Me.FilterMode = True Then
With Application
.EnableEvents = False
.ScreenUpdating = False
End With
With ActiveWorkbook
.CustomViews.Add ViewName:="Mine", RowColSettings:=True
Me.AutoFilterMode = False
.CustomViews("Mine").Show
.CustomViews("Mine").Delete
End With
With Application
.EnableEvents = True
.ScreenUpdating = True
End With
End If
End Sub
This last code, I don't understand any of it, so I can't even edit it to correspond with my own worksheet, if I even have to.
What I am doing is right clicking on my worksheet name, selecting view code, pasting the code in the screen, saving and then going back to excel. Maybe I am putting the codes in wrong, I have no idea.
Does anyone have an idea why these aren't working? My worksheet name is "Downtime Summary Primary HIDE", which I put into the first code. The second code seems pretty straightforward, no editing needed that I can see, yet still doesn't work.
Please help the not so smart newbie.