VBA to copy 2 columns from a closed workbook

could an expert provide VBA that will copy columns C and Columns L from a closed workbook into my current workbook

The path for the closed workbook is C:\jagwarman\AP\Reports

There will only ever be one file in that folder called LDNEQUEQF012

Copy column C and column L from that file into current workbook sheet1 column C into column A column L into column B

many thanks
JagwarmanAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Ryan ChongCommented:
try customize this...

Sub testCopy()
    Dim wb As Workbook
    Application.CutCopyMode = False
    Application.ScreenUpdating = False
    Application.DisplayAlerts = False
    
    filePath = "C:\jagwarman\AP\Reports\LDNEQUEQF012.xls"
    Set wb = Application.Workbooks.Open(filePath)
    
    wb.ActiveSheet.Range("C:C").Copy Destination:=ThisWorkbook.Worksheets(1).Columns("A")
    
    wb.ActiveSheet.Range("L:L").Copy Destination:=ThisWorkbook.Worksheets(1).Columns("B")
    wb.Close False
    Set wb = Nothing

    Application.DisplayAlerts = True
    Application.ScreenUpdating = True
    Application.CutCopyMode = False
    
End Sub

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
JagwarmanAuthor Commented:
that's perfect thanks
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.