Help with Advanced filter

stuckyetagain

New Member
Joined
May 31, 2015
Messages
3
I have 2 macros that deploy an advancedfilter called by the worksheet_change event dependant on a data validation list. This works fine to copy the data from the master list to the individual tabs and sort information for easy viewing. When the data is deleted however the tabs aren't updated. Can anybody help teach me how to make the tabs refresh when the data is deleted. I am attaching samples of code to show what I have done so far.

Code:
Private Sub WorkSheet_Change(ByVal Target As Range)


Select Case Target


Case "Warehouse"
Worksheets("Floor Stock").Activate
  Call GetFloorStock
Worksheets("Warehouse").Activate
  Call GetWarehouse


  
Case "Floor Stock"
Worksheets("Warehouse").Activate
  Call GetWarehouse
Worksheets("Floor Stock").Activate
  Call GetFloorStock
  
Case Else:
End Select

Code:
Sub GetFloorStock()
'
' GetFloorStock Macro
'


'
ActiveSheet.Cells.Clear
  
Dim NextRow As Long
    With Sheets("Floor Stock")
    
        If Not IsEmpty(ThisWorkbook.Sheets("Phase 1").Range("a2").Value) Then
    
        NextRow = .Range("A65536").End(xlUp).Row
        
        Sheets("Phase 1").Columns("A:L").AdvancedFilter Action:=xlFilterCopy, _
        CriteriaRange:=Sheets("Sheet4").Range("c1:c2"), CopyToRange:=.Range("A" & NextRow), _
        unique:=True
        
        End If
        
        If IsEmpty(ThisWorkbook.Sheets("Phase 1").Range("a2").Value) Then
        
        ActiveWorkbook.Worksheets("Floor Stock").Select
        NextRow = .Range("A65536").End(xlUp).Row + 1
        .Range("A" & NextRow).EntireRow.Delete
        
        End If

The if isempty formula doesn't seem to be achieving the desired outcome of deleting the filtered data to the tabs when the original data is deleted.

Any suggestions would be greatly appreciated.
 

Excel Facts

Save Often
If you start asking yourself if now is a good time to save your Excel workbook, the answer is Yes
Solved the problem myself...
Code:
If IsEmpty(Target) Then Exit Sub
 
If Not Intersect(Target, Range("N:N")) Is Nothing Then
 
    Worksheets("Floor Stock").Activate
      Call GetFloorStock
 
.....
     
End If
 
Upvote 0

Forum statistics

Threads
1,214,397
Messages
6,119,271
Members
448,882
Latest member
Lorie1693

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top