+ Reply to Thread
Results 1 to 5 of 5

Copying data range from a variablew workbook to static workbook

  1. #1
    Registered User
    Join Date
    06-10-2013
    Location
    Hyderabad
    MS-Off Ver
    Excel 2010
    Posts
    3

    Post Copying data range from a variablew workbook to static workbook

    i am new to excel and also to Excel forum.
    i need to update data for a similar set of cells of one workbook from a similar set of cells from another workbook, on a monthly basis. could someone please help me with a simple macro.
    Thanks and help much appreciated in advance.

    -Singhpab

  2. #2
    Forum Contributor
    Join Date
    08-02-2012
    Location
    Pune
    MS-Off Ver
    Office 365 (Win 10)
    Posts
    489

    Re: Copying data range from a variablew workbook to static workbook

    Have a look at this post. Is this enough for you?

  3. #3
    Registered User
    Join Date
    06-10-2013
    Location
    Hyderabad
    MS-Off Ver
    Excel 2010
    Posts
    3

    Re: Copying data range from a variablew workbook to static workbook

    Thanks for the reply. but i was looking for sometime which copies data from a additional month's tab of a statically formatted workbook to another statically formatted workbook (with only one tab). here we can say it is a data update for different tables. the range of the table does not change any time.
    Thanks again for your help on this.

  4. #4
    Forum Contributor
    Join Date
    08-02-2012
    Location
    Pune
    MS-Off Ver
    Office 365 (Win 10)
    Posts
    489

    Re: Copying data range from a variablew workbook to static workbook

    How about this?


    PHP Code: 
    Sub openAndCopy()
        
    Dim wbCopy As Workbook
        Dim wsCopy 
    As Worksheet
        Dim rngCopy 
    As Range
        Dim wbPaste 
    As Workbook
        Dim wsPaste 
    As Worksheet
        Dim rngPaste 
    As Range
        
        Set wbCopy 
    Workbooks.Open(ThisWorkbook.Path "\Source_Workbook.xlsx")    'change path
        Set wsCopy = wbCopy.Worksheets("Source Tab Name")
        Set rngCopy = wsCopy.Range("a:av").EntireColumn   
        Set wbPaste = Workbooks("Destination Workbook.xlsm")
        Set wsPaste = wbPaste.Worksheets("Destination tab name")  '
    paste to different sheet?
        
    Set rngPaste wsPaste.Range("a1")  'change this if needed
        
        rngCopy.Copy
        rngPaste.PasteSpecial xlPasteValues
        Application.CutCopyMode = False
        Workbooks("Source_Workbook.xlsx").Close SaveChanges:=False
        


    End Sub 

  5. #5
    Registered User
    Join Date
    06-10-2013
    Location
    Hyderabad
    MS-Off Ver
    Excel 2010
    Posts
    3

    Re: Copying data range from a variablew workbook to static workbook

    Thanks Aki Bhai , but request you to help me in understanding this. As when i gave the path with the complete book name it throwed an error 424 on me.

+ 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