+ Reply to Thread
Results 1 to 6 of 6

Recording & showing historical data

  1. #1
    Registered User
    Join Date
    05-28-2013
    Location
    London, England
    MS-Off Ver
    Excel 2007
    Posts
    3

    Recording & showing historical data

    Hi,

    I have a spreadsheet that summaries back-end data from my website. Each time I refresh it updates the spreadsheet.

    I am wanting to create a new sheet that records & reflects the data over a period of time, so that we can start analysis trends.

    I have written the following macro that should, each time I run it, copy the data and paste it into the next free row in the new spreadsheet. However, it keeps pasting the data in the same row and overwriting previous data.

    Please let me know if you can figure out what I am doing wrong.

    Sub recorder()

    Application.ScreenUpdating = False

    Dim lastRow As Integer

    lastRow = Sheets("historical").Range("p65536").End(xlUp).Row + 1

    Range("C2").Copy

    Sheets("historical").Range("A" & lastRow).PasteSpecial xlPasteValues

    Range("C3").Copy

    Sheets("historical").Range("B" & lastRow).PasteSpecial xlPasteValues

    Application.ScreenUpdating = True

    End Sub

    Thanks
    Jud

  2. #2
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Recording & showing historical data

    Please use code tags with your code
    Are you copying Range("C2"). and C3 from the same sheet: Sheets("historical"). to the same sheet?

  3. #3
    Registered User
    Join Date
    05-28-2013
    Location
    London, England
    MS-Off Ver
    Excel 2007
    Posts
    3

    Re: Recording & showing historical data

    Thanks AB33

    Yes, C2 & C3 are from the same sheet ("Report") and are both being pasted into Sheets ("historical")

    Code with wraps:

    Please Login or Register  to view this content.

  4. #4
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Recording & showing historical data

    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    05-28-2013
    Location
    London, England
    MS-Off Ver
    Excel 2007
    Posts
    3

    Re: Recording & showing historical data

    Works perfectly, thank you very much AB33

    Have a great day!!

    Regards
    Jud

  6. #6
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Recording & showing historical data

    Jud,
    You are welcome!

+ 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