+ Reply to Thread
Results 1 to 8 of 8

Update Web Query Without deleting old data, just update new ones.

Hybrid View

  1. #1
    Registered User
    Join Date
    05-27-2017
    Location
    usa
    MS-Off Ver
    windows1o
    Posts
    5

    Update Web Query Without deleting old data, just update new ones.

    Hi ,
    I have created a Web query in Excel I put it to refresh every 10 minutes and all the old data is removed with the new data .
    This is the website in question

    http://www.dmxmusic.com/guide/whats_...channel_id=100

    I would like excel to update with the new songs played without deleting the songs that played before, in other words I want to get a list of all songs played in a day.

    Thank you very much in advance.
    Last edited by pancho111; 05-28-2017 at 11:29 PM.

  2. #2
    Forum Expert
    Join Date
    11-22-2016
    Location
    Cornwall,UK
    MS-Off Ver
    office 365
    Posts
    4,240

    Re: Update Web Query Without deleting old data, just update new ones.

    Hi, welcome to the forum
    see attached file
    Try this:

    This sub calls itself every 10 minutes
    Sub CopyList()
    'set variables
        Dim wsD As Worksheet, wsH As Worksheet, rngD As Range, rngH As Range
        Set wsD = Sheets("Download"): Set wsH = Sheets("DownloadHistory")
    'ranges to copy and paste
        Set rngD = wsD.Range("A1").CurrentRegion.Offset(2)
        Set rngD = rngD.Resize(rngD.Rows.Count - 2)
        Set rngH = wsH.Range("A" & Cells.Rows.Count).End(xlUp).Offset(1)
    'copy and paste the data
        rngD.Copy rngH
    'remove duplicates
        Set rngH = rngH.CurrentRegion
        rngH.RemoveDuplicates Columns:=Array(1, 2, 3, 4), Header:=xlYes
    'repeat after 10 minutes
        Application.OnTime Now + TimeValue("00:10:00"), "CopyList"
    End Sub
    Do you want the sub to run automatically when the file is opened? Add this to the ThisWorkbook module
    Private Sub Workbook_Open()
        Call CopyList
    End Sub
    Attached Files Attached Files
    Last edited by kev_; 05-29-2017 at 03:52 PM.
    Click *Add Reputation to thank those who helped you. Ask if anything is not clear

  3. #3
    Registered User
    Join Date
    05-27-2017
    Location
    usa
    MS-Off Ver
    windows1o
    Posts
    5

    Re: Update Web Query Without deleting old data, just update new ones.

    Thank you very much for your help , I really appreciate it
    I have a little issue
    Every time it refreshes it says
    Unable to open http://www.dmxmusic.com/guide/whats_...channel_id=100. Cannot download the information you requested
    I am using excel
    office excel 2003 on windows 10
    office excel 2011 on Mac

    Windows does not accept xlsm file
    Mac does ,but it is giving me the error above
    I have not been able to try it on windows because does not accept xlsm

    thanks again

  4. #4
    Forum Expert
    Join Date
    11-22-2016
    Location
    Cornwall,UK
    MS-Off Ver
    office 365
    Posts
    4,240

    Re: Update Web Query Without deleting old data, just update new ones.

    The link worked for me. But perhaps you could try removing it and recreating on your Mac - there may be some difference in the way Excel for Mac does the linking

    Excel 2003 - create a file with the 2 worksheets named as per my download, add the data import link etc and place the VBA in a general module. (Hopefully it will work - the VBA is basic)

  5. #5
    Registered User
    Join Date
    05-27-2017
    Location
    usa
    MS-Off Ver
    windows1o
    Posts
    5

    Re: Update Web Query Without deleting old data, just update new ones.

    What operating system and version of excel are you using ?
    thanks

  6. #6
    Registered User
    Join Date
    05-27-2017
    Location
    usa
    MS-Off Ver
    windows1o
    Posts
    5

    Re: Update Web Query Without deleting old data, just update new ones.

    HI , can you please try it again .
    It is refreshing the download sheet every 10 min,but not updating the DownloadHistory sheet .
    I bought the latest version of office for windows 10
    I am sorry to bother too much
    thanks

  7. #7
    Registered User
    Join Date
    05-27-2017
    Location
    usa
    MS-Off Ver
    windows1o
    Posts
    5

    Re: Update Web Query Without deleting old data, just update new ones.

    Thank you very much , working now
    Excel was blocking the macro from working ... got it to work ..
    thank you so much

  8. #8
    Forum Expert
    Join Date
    11-22-2016
    Location
    Cornwall,UK
    MS-Off Ver
    office 365
    Posts
    4,240

    Re: Update Web Query Without deleting old data, just update new ones.

    Glad it worked for you 😀
    Please mark thread as solved - see thread tools at top of thread

+ 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. [SOLVED] VBA Query to Overrite the Data after Update and Preserving the Format
    By sathis in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-11-2015, 06:24 AM
  2. Transfer/update columns from 1 sheet to another + update chart & data selection
    By Julien355 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 04-29-2015, 11:54 PM
  3. [SOLVED] VLookup Question - If i update the lookup table i do not want to update old data
    By mrabattoir in forum Excel Formulas & Functions
    Replies: 10
    Last Post: 04-28-2014, 03:40 AM
  4. [SOLVED] Importing data and update, query?
    By Eemmai in forum Excel General
    Replies: 1
    Last Post: 10-24-2012, 11:21 AM
  5. Automatically update existing data using a Update command button
    By 9999335 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 07-23-2012, 09:46 PM
  6. Update data by inserting/deleting new row
    By ioncila in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 05-28-2009, 06:04 PM
  7. how to update data on sheet1 and have it auto update on sheet2
    By Tommy in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 05-11-2005, 06:43 PM

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