+ Reply to Thread
Results 1 to 2 of 2

Macro to grab files(changes names) off shared drive and copy values into another sheet

Hybrid View

  1. #1
    Registered User
    Join Date
    07-24-2012
    Location
    New York, NY
    MS-Off Ver
    Excel 2003
    Posts
    1

    Macro to grab files(changes names) off shared drive and copy values into another sheet

    I recorded a macro and successfully came up with this: However, two of the file names change daily to reflect the date.. So I am not sure if this will work tomm when the file's name has been changed.

    Any help is appreciated. Thank you.. I am basically opening up files off a shared drive and copying the values into a given spreadsheet..if there is a simpler process than the below to achieve it that would be great. But it works fine as of n

    Sub BrokerFiles()
    '
    ' BrokerFiles Macro
    ' Grab Files from G and paste into respective columns
    '
    ' Keyboard Shortcut: Ctrl+Shift+A
    '
        ChDir "G:\RDA\Convertible Models\Broker Files"
        Workbooks.Open filename:= _
            "G:\RDA\Convertible Models\Broker Files\CVG_PriceComp_07232012.xls"
        Application.Run "wkbModel.wb_Activate"
        Application.Run "GetToolbarButtonsStatus"
        Application.Run "wb_Open"
        Columns("A:N").Select
        Selection.Copy
        Windows("Convert Pricing_singh031802.xls").Activate
        Application.Run "wkbModel.wb_Activate"
        Application.Run "GetToolbarButtonsStatus"
        Sheets("Barclays").Select
        Columns("A:N").Select
        Range("A136").Activate
        Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
            :=False, Transpose:=False
        Windows("CVG_PriceComp_07232012.xls").Activate
        ActiveWindow.Close
        Application.Run "wkbModel.wb_Activate"
        Application.Run "GetToolbarButtonsStatus"
        Application.Run "GetToolbarButtonsStatus"
        Application.Run "wkbModel.wb_Activate"
        Application.Run "GetToolbarButtonsStatus"
        Workbooks.Open filename:="G:\RDA\Convertible Models\Broker Files\1 (9).xls"
        Application.Run "wkbModel.wb_Activate"
        Application.Run "GetToolbarButtonsStatus"
        Application.Run "wb_Open"
        Columns("A:H").Select
        Selection.Copy
        Windows("Convert Pricing_singh031802.xls").Activate
        Application.Run "wkbModel.wb_Activate"
        Application.Run "GetToolbarButtonsStatus"
        Sheets("FBR").Select
        Columns("A:H").Select
        Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
            :=False, Transpose:=False
        Windows("1 (9).xls").Activate
        ActiveWindow.Close
        Application.Run "wkbModel.wb_Activate"
        Application.Run "GetToolbarButtonsStatus"
        Application.Run "GetToolbarButtonsStatus"
        Application.Run "wkbModel.wb_Activate"
        Application.Run "GetToolbarButtonsStatus"
        Workbooks.Open filename:= _
            "G:\RDA\Convertible Models\Broker Files\GMI 07232012.xls"
        Application.Run "wkbModel.wb_Activate"
        Application.Run "GetToolbarButtonsStatus"
        Application.Run "wb_Open"
        Columns("B:B").ColumnWidth = 12.43
        Columns("B:B").ColumnWidth = 17.57
        ActiveWindow.SmallScroll Down:=-30
        Columns("A:J").Select
        Selection.Copy
        Windows("Convert Pricing_singh031802.xls").Activate
        Application.Run "wkbModel.wb_Activate"
        Application.Run "GetToolbarButtonsStatus"
        Sheets("ML").Select
        Columns("B:K").Select
        Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
            :=False, Transpose:=False
        Windows("GMI 07232012.xls").Activate
        ActiveWindow.Close
        Application.Run "wkbModel.wb_Activate"
        Application.Run "GetToolbarButtonsStatus"
        Application.Run "GetToolbarButtonsStatus"
        Application.Run "wkbModel.wb_Activate"
        Application.Run "GetToolbarButtonsStatus"
    End Sub
    Last edited by Cutter; 07-24-2012 at 06:01 PM. Reason: Added code tags

  2. #2
    Forum Expert Cutter's Avatar
    Join Date
    05-24-2004
    Location
    Ontario,Canada
    MS-Off Ver
    Excel 2010
    Posts
    6,451

    Re: Macro to grab files(changes names) off shared drive and copy values into another sheet

    @ komosso22

    Welcome to the forum.

    Please notice that code tags have been added to your post(s). The forum rules (Rule #3) require them so please keep that in mind and add them yourself whenever showing code in any of your future posts. To see instructions for applying them click on the Forum Rules button at top of the page and see rule #3.
    Thanks.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1