diygail123
New Member
- Joined
- Oct 24, 2018
- Messages
- 25
#
Hi, can anyone see why this code is bugging please?
Hi, can anyone see why this code is bugging please?
Code:
[COLOR=#333333]Sub CopyFltr()[/COLOR]
[COLOR=#333333]'DECLARE VARIABLES[/COLOR]
[COLOR=#333333]Dim Ws As Worksheet[/COLOR]
[COLOR=#333333]Dim Cl As Range[/COLOR]
[COLOR=#333333]Application.ScreenUpdating = False[/COLOR]
[COLOR=#333333]Set Ws = Sheets("Import")[/COLOR]
[COLOR=#333333]'FILTER ON EACH VENDOR ON IMPORT TAB[/COLOR]
[COLOR=#333333]If Ws.AutoFilterMode Then Ws.AutoFilterMode = False[/COLOR]
[COLOR=#333333]With CreateObject("Scripting.dictionary")[/COLOR]
[COLOR=#333333]For Each Cl In Ws.Range("B5", Ws.Range("B" & Rows.Count).End(xlUp))[/COLOR]
[COLOR=#333333]If Not .Exists(Cl.Value) Then[/COLOR]
[COLOR=#333333].Add Cl.Value, Nothing[/COLOR]
[COLOR=#333333]Ws.Range("A4:o4").AutoFilter 2, Cl.Value[/COLOR]
[COLOR=#333333]Ws.AutoFilter.Range.Copy[/COLOR]
[COLOR=#333333]Sheets(Cl.Value).Activate [/COLOR][SIZE=5][COLOR=#333333][COLOR=#ff0000]'BUGGING HERE[/COLOR][/COLOR][/SIZE]
[COLOR=#333333]Range("A6").Paste[/COLOR]
[COLOR=#333333]'Ws.AutoFilter.Range.Copy Sheets(Cl.Value).Range("A4")[/COLOR]
[COLOR=#333333]End If[/COLOR]
[COLOR=#333333]Next Cl[/COLOR]
[COLOR=#333333]End With[/COLOR]
[COLOR=#333333]Ws.AutoFilterMode = False[/COLOR]
[COLOR=#333333]ActiveWindow.View = xlNormalView[/COLOR]
[COLOR=#333333]MsgBox ("Vendor tabs have now been updated")[/COLOR]
[COLOR=#333333]Sheets("Macros").Activate[/COLOR]
[COLOR=#333333]End Sub[/COLOR]
Last edited by a moderator: