• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

VBA code for openning workbook in different location and copy data range and paste in current workbook

daxeman

New Member
Hi,

I am trying to create a VBA code that can open a workbook that is saved in different locations with varying file names.

But the sheet name and range remains the same. I want to select a constant range and copy it and paste values in the current openned work book.

Shown below is my code.

Code:
>>> You've already noted <<<
>>> use code - tags <<<

Code:
Sub Macro2()

    Workbooks.Open Filename:= _
        "C:\Users\dakis\Documents\99_blast_review\M001_WGP_Daily_Production_Report_221114.xlsx"
    Columns("A:Q").Select
    Range("Q1").Activate
    Selection.Copy
    Windows("Warrawoona_Digrates.xlsm").Activate
    ActiveWindow.SmallScroll Down:=-15
    Sheets("L&H_Input").Select
    Range("U1").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
    Sheets("digrates").Select
End Sub
 

Attachments

Last edited by a moderator:
Top