vba on datasource

Dwjenkins

New Member
Joined
Nov 14, 2013
Messages
6
Hi All

I have connected Microsoft Query to download from my SQL Server with a Parameter from a cell.

However, when it runs it deletes all the information within the table. But what I want it to do is append the date to the end.

Basically, cell A2 has a DateID based on the formula =max(N:N)-8, the query then returns all date for the past 8 weeks. It should then overwrite the 7 weeks of data with anything thats changed and the 8 week will always be new data.

I am assuming that I need some vba wizardy here.
 

Excel Facts

How to change case of text in Excel?
Use =UPPER() for upper case, =LOWER() for lower case, and =PROPER() for proper case. PROPER won't capitalize second c in Mccartney
You already have a Macro to do to fetch the data? You just want the code amending to put the new data in the correct location? (If so can we have a look at the code)
 
Upvote 0
No its not a macro, it comes from a DataSource through microsoft query.

I was thinking about this earlier and 'updating might not be best way of doing it. I think it should probably delete the last 7 weeks of data and then once the DataSource is run it should append the data to bottom of the current table.
 
Upvote 0

Forum statistics

Threads
1,214,656
Messages
6,120,762
Members
448,991
Latest member
Hanakoro

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top