+ Reply to Thread
Results 1 to 2 of 2

Refresh External Data - Row disappears. VBA help

  1. #1
    Registered User
    Join Date
    10-18-2013
    Location
    Halifax, England
    MS-Off Ver
    Excel 2007
    Posts
    4

    Refresh External Data - Row disappears. VBA help

    Hi all.

    I've trawled the internet for an answer to this issue to no avail. Although I'm sure it's probably a rookie mistake!

    Background: I've developed a spreadsheet which takes data from an access database, and produces a calendar of upcoming implementations in our department. In theory, very simple. The calendar is on a separate sheet and is very simple - works perfectly, with dates on the X axis and implementation names on the Y. The sheet checks the imported data and using if statements, displays the start and end times of the implementation by displaying S and E in the relevant date cell, then conditional formatting. So far so good.

    HOWEVER, when I refresh the data source, the previous last row in the "data" sheet must get deleted and recreated, because I get a row missing in my calendar. Let's say the last row on the data sheet was A7. After refreshing the data, the row in the calendar referencing A7 disappears, it goes straight from 6 to 7.

    All well and good, I thought it was probably simply an issue with the data refreshing functionality built in, so I built a macro which deletes the formulas from the calendar sheet, refreshes the data using a simple ActiveWorkbook.RefreshAll, then reintroduces the formulas into the calendar. However, the issue of the missing row persists when the macro is run. When I step through the code it's fine. I thought the import might be taking more time than the macro, so I added a wait of 10 seconds (way more than it needs), but the issue continued.

    I then thought it might be because the sub which refreshes the data might need to end before the format sub (maybe it was doing it in parallel), so I split the macro into 2, and ran them sequentially from a third sub. Still happens.

    I've tried everything I can think of. My only current workaround is to split them into 2 separate buttons, which works perfectly, but it's a bit silly considering it's such a simple thing to achieve!

    I've even tried running the format macro multiple times after the import, but it doesn't work, however running the whole suite twice (i.e. 2 clicks) does work.

    I'm stumped!

    Help!

  2. #2
    Registered User
    Join Date
    10-18-2013
    Location
    Halifax, England
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: Refresh External Data - Row disappears. VBA help

    Just discovered the issue. Nothing wrong with my code, it was a rookie mistake, I just set external data properties to clear unused cells rather than delete, it now works perfectly.

+ 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. Pivot Table Refresh - Data Disappears
    By dkomar24 in forum Excel General
    Replies: 0
    Last Post: 08-30-2011, 11:08 AM
  2. [SOLVED] Pivot column disappears after external data refresh
    By Fabio Missana in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 08-22-2006, 10:15 AM
  3. chart formating disappears when i refresh pivot table data
    By wunder boy in forum Excel General
    Replies: 3
    Last Post: 08-16-2006, 06:38 AM
  4. [SOLVED] Refresh external data
    By [email protected] in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-05-2006, 07:50 AM
  5. [SOLVED] external data refresh
    By shoreguy in forum Excel General
    Replies: 0
    Last Post: 03-07-2006, 02:35 PM

Tags for this Thread

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