Unable to execute macro

ian0886

New Member
Joined
Dec 10, 2016
Messages
42
Hi Guys,

I'm having some issues trying to run the macro below. I'm trying to copied the filter data from wbI to the each tab on another workbook (tickets). i seem to have missed out something but i can't figure it out. Much appreciated if someone could shed some light. Thanks!
Code:
Sub Trial()    
    SearchCol = "Portfolio"
    Dim rng1 As Range
    Set rng1 = ActiveSheet.UsedRange.Find(SearchCol, , xlValues, xlWhole)
    
    Dim wbI As Workbook
    Dim wsI As Worksheet
    
    Dim c(1 To 5) As String
    c(1) = "LDN"
    c(2) = "TKY"
    c(3) = "NY4"
    c(4) = "POPNY4"
    c(5) = "POP Swap"
    
    Dim ws(1 To 5) As Worksheet
    ws(1) = Workbooks("tickets").Worksheets("T-Data")
    ws(2) = Workbooks("tickets").Worksheets("TY -Data")
    ws(3) = Workbooks("tickets").Worksheets("NY -Data")
    ws(4) = Workbooks("tickets").Worksheets("POPNY4 -Data")
    ws(5) = Workbooks("tickets").Worksheets("POPSWOP -Data")
    
    Set wbI = ActiveWorkbook
    Set wsI = wbI.Sheets("BNP")
    
    Dim counter As Integer
    For counter = 1 To 5
    
    Workbooks("Fx_Activity.csv").Activate
    Range("a1").AutoFilter Field:=rng1.Column, Criteria1:=c(counter)
    
    wsI.Range("a1").CurrentRegion.Copy
    ws(counter).Range("a1").PasteSpecial xlPasteAll, Operation:=xlNone, _
        SkipBlanks:=False, Transpose:=False
    Next




End Sub
 

Excel Facts

What do {} around a formula in the formula bar mean?
{Formula} means the formula was entered using Ctrl+Shift+Enter signifying an old-style array formula.
Glad to help & thanks for the feedback
 
Upvote 0

Forum statistics

Threads
1,223,903
Messages
6,175,287
Members
452,631
Latest member
a_potato

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