Results 1 to 2 of 2

macro to open, copy paste from existing excel file to a new blank file

Threaded View

  1. #1
    Registered User
    Join Date
    08-15-2012
    Location
    maryland
    MS-Off Ver
    Excel 2003
    Posts
    1

    macro to open, copy paste from existing excel file to a new blank file

    Hello All My name is 2Blessed....there is a file created every month that I must use to extract 2 columns of data and put into my spreadsheet. I have a code to get the data from the specific file for the month but I want to use a code that I will not have to change every month to open any file copy and paste the columns of data I need into my spreadsheet.
    This is what I have now but it is for the month specifically
    Sub Get2Columns()
    '
    ' Get2Columns Macro
    'Count Number of Rows In Worksheet
    i = 1
    Do While ActiveWorkbook.Sheets(1).Cells(i, 1) <> ""
    i = i + 1
    Loop
    i = i - 1
    
    
    '
        Workbooks.Open Filename:= _
            "Z:\Ops Support\Reports\Implementation Report\MAPD_Bus_Ops_ImplementationSupportReport2012\07. MAPD_Bus_Ops_ImplementationSupportReportJuly_2012_07_01.xlsx"
        Range("A1:C2").Select
        With Selection
            .HorizontalAlignment = xlLeft
            .VerticalAlignment = xlBottom
            .WrapText = True
            .Orientation = 0
            .AddIndent = False
            .IndentLevel = 0
            .ShrinkToFit = False
            .ReadingOrder = xlContext
            .MergeCells = False
        End With
        Columns("C:D").Select
        Selection.Copy
        Windows("JCLNONJCLApp.xlsm").Activate
        Columns("A:B").Select
        ActiveSheet.Paste
    End Sub
    Last edited by Cutter; 08-15-2012 at 06:05 PM. Reason: Added code tags

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