+ Reply to Thread
Results 1 to 8 of 8

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

Hybrid View

  1. #1
    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

+ 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