Quantcast
Viewing all articles
Browse latest Browse all 50151

improve the vba code for refresing QueryTable

I have this code to refresh the query table and copy the values to anther sheet.
I'm facing problem with the refresh of the querytable takes time so copying the value become wrong

Code:

Sub refad()

Sheets("Date").Range("e10").QueryTable.Refresh BackgroundQuery:=False              'this takes long time

Sheets("disp").Range("b10:h20").Value = Sheets("date").Range("a10:g20").Value      'so this take the old values not the refreshed values

End Sub


I want to re-write the code to be like this

after querytable refresh finish go to copying values

or if the querytbale refresh end then do this and this


like this

Viewing all articles
Browse latest Browse all 50151

Trending Articles