+ Reply to Thread
Results 1 to 2 of 2

Help in export data in a new excel file

  1. #1
    Registered User
    Join Date
    01-25-2011
    Location
    Italy
    MS-Off Ver
    Excel 2003
    Posts
    1

    Help in export data in a new excel file

    I need to automatically export data i type in file A to a file B wich contains previously typed data. In example, if i type in file A:

    23
    34
    54

    I need these data goes to file B under older rows data:

    43 (old)
    54 (old)
    65 (old)
    23
    34
    54

    and so on..the next time i type newer data, they have to go under older ones.

    How can i do this?

  2. #2
    Registered User
    Join Date
    01-24-2011
    Location
    India
    MS-Off Ver
    Excel 2003
    Posts
    12

    Re: Help in export data in a new excel file

    Hi,

    Paste this macro inside the module of the file from which you have to export the data. Run it and let me know the status...


    'This macro has to be stored in the file from which you want the contents to be exported and it has to be executed from that file only
    Sub mymacro()
    Dim entrycounter As Integer
    'mention the filename(where you want the contents to copied) with the complete path within the double quotes
    ActiveWorkbook.Activate
    'enter the sheetname within the double quotes in which you have the contents which has to be copied
    Sheets("Sheet1").Activate
    'selects all the cells from the sheet1
    ActiveSheet.Cells.Select
    'copies everything from the sheet1
    Selection.Copy
    'opens the destination file
    Workbooks.Open Filename:="F:\testing.xlsx"
    'activates the destination file
    Workbooks("testing.xlsx").Activate
    'Activates the sheet where copied contents has to be pasted
    Sheets("Sheet1").Activate
    'Activates the first cell
    Range("A1").Activate
    'counts already filled rows
    Range("B1048576").Formula = "=count(A1:A1048576)"
    'stores the result in one cell
    entrycounter = Range("B1048576").Value
    'Activate the next blank row
    ActiveCell.Offset(entrycounter, 0).Activate
    'pastes the copied contents below the already existing content
    ActiveCell.PasteSpecial (xlPasteAll)
    End Sub

+ 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