Results 1 to 3 of 3

Modify an existing macro to not copy to the same workbook but another one.

Threaded View

  1. #1
    Registered User
    Join Date
    08-10-2009
    Location
    Tallinn, Estonia
    MS-Off Ver
    Excel 2007
    Posts
    10

    Modify an existing macro to not copy to the same workbook but another one.

    I have about 300 lines of the following macro:

    Sheets("Sheet1").Range("B2").Value = Sheets("Tabel 1").Range("C15").Value
        Sheets("Sheet1").Range("C2").Value = Sheets("Tabel 1").Range("D15").Value  
        Sheets("Sheet1").Range("D2").Value = Sheets("Tabel 2").Range("C14").Value
        Sheets("Sheet1").Range("E2").Value = Sheets("Tabel 2").Range("D14").Value
        Sheets("Sheet1").Range("F2").Value = Sheets("Tabel 3").Range("C15").Value
        Sheets("Sheet1").Range("G2").Value = Sheets("Tabel 3").Range("D15").Value
        Sheets("Sheet1").Range("H2").Value = Sheets("Tabel 4").Range("H15").Value
        Sheets("Sheet1").Range("I2").Value = Sheets("Tabel 5").Range("C14").Value
        Sheets("Sheet1").Range("J2").Value = Sheets("Tabel 5").Range("D14").Value
        Sheets("Sheet1").Range("K2").Value = Sheets("Tabel 6").Range("I15").Value
    It copies from 6 different tables data to sheet1 in the same workbook.
    Now I would like to change it so that it will copy the data to another workbook I have open. The name of the new workbook is “Andmed” (file name). Sheet name is still sheet1. The workbook name of the file where I will copy from will change as I need to run this macro about 200 times. I will probably run the macro from this workbook but store it in “Andmed” workbook.
    Also before copying the data it should insert a new line to workbook “Andmed” sheet1 line2. To greate a space for the data as not to overwrite previous data.

    All help will be greatly appreciated,
    Last edited by arlu1201; 04-29-2013 at 02:11 AM.

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