+ Reply to Thread
Results 1 to 4 of 4

Arciving Data from One Sheet to the next

Hybrid View

  1. #1
    Registered User
    Join Date
    09-23-2008
    Location
    Yokosuka Japan
    Posts
    44

    Arciving Data from One Sheet to the next

    I am trying to write/modify an exsisting macro that will transfer data from the "My Data" page to the "Archive" page. I have searched other threads on the website and could not find one that really suited my needs.

    Sub XferData()
    Dim sht As Worksheet, outsht As Worksheet, r As Long
    Set outsht = Sheets("Archive")
    If ActiveSheet.Name = outsht.Name Then
    MsgBox "You must activate this macro from data sheet"
    Exit Sub
    End If
    Set sht = ActiveSheet
    r = outsht.Range("A" & Rows.Count).End(xlUp).Row + 1
    End Sub
    Here is the question: I have daily data (A2:G13) that is always changing but but never goes beyond G13. I would like the macro to send the values in the range A2:G13 to the "Archive" Page. The attached sheet may give a better graphic of my question.

    But each time I press the archive button the macro adds the new days data to the running tally. Then at the end of a week or a quarter or the year I can use a pivot table to look at the collected data set.

    Any help with this would be great. Thanks.

    BusDriver2
    Attached Files Attached Files
    Last edited by BusDriver2; 10-13-2008 at 10:04 AM.

  2. #2
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    Try thgis

    Sub XferData()
        Dim sht    As Worksheet
        Dim outsht As Worksheet
        Dim rng    As Range
        Dim r      As Long
        Set outsht = ThisWorkbook.Sheets("Archive")
        Set rng = Sheet1.Range(Cells(1, 1), Cells(Rows.Count, 7).End(xlUp))
        r = outsht.Cells(Rows.Count, 1).End(xlUp).Row + 1
        rng.Copy outsht.Cells(r, 1)
    End Sub
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  3. #3
    Registered User
    Join Date
    09-23-2008
    Location
    Yokosuka Japan
    Posts
    44
    royUK,

    That is a great macro it certianly has applications that I will use on other projects. But I really need this macro to archive a bunch of data at once, not just one line at a time.

    The scenario is this: I come in to work in the morning and I have to take sampling data which only takes a few minutes; but I have to take several samples. I then enter the data in the Cell Range A2:G13 and then I would like to be able to archive the data for later massaging. Each time I archive the days data it simply adds on to the ever growing range of data. Is this possible?

    Thanks for your speedy response.

    BusDriver2

  4. #4
    Registered User
    Join Date
    09-23-2008
    Location
    Yokosuka Japan
    Posts
    44

    My mistake

    royUK,

    Now that I have gotten some sleep I can see that your macro does everything that I asked for. Thank You for your time and a apologize for being slow on my understanding.

    Best Regards,

    BusDriver2

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Gathering and listing data from another sheet
    By Jonibenj in forum Excel General
    Replies: 10
    Last Post: 10-26-2008, 09:55 AM
  2. Replies: 3
    Last Post: 02-13-2008, 06:28 PM
  3. Macro to Search, Copy/Paste onto New Sheet
    By JADownie in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-13-2008, 04:57 PM
  4. Searching for a sheet and using data from the matching sheet.
    By meacho in forum Excel Formulas & Functions
    Replies: 11
    Last Post: 07-06-2007, 09:51 AM
  5. reference to external data sheet
    By matrixknow in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-11-2007, 08:44 AM

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