New Excel Forum

This forum has been moved to TeachExcel.com

Ask all future questions in the New Excel Forum.

ExcelKey

msqueries with in excel

Macros, VBA, Excel Automation, etc.

msqueries with in excel

Postby gabbie » Sat Jan 14, 2012 6:42 pm

I have set up a msquery with a set amount of data. (to be exact 8640 rows of data). When the data is refreshed into an excel worksheet, everything comes forward, giving me more than the 8640 rows of data that is needed. How do I eliminate this problem. Would VBA programming do the trick? I am not sure how to start?

Thanks
  • 0

gabbie
Rookie
 
Posts: 7
Joined: Jan 9, 2012
Reputation: 0

Re: msqueries with in excel

Postby Sisyphus » Sun Jan 15, 2012 3:18 am

Hi,
I'm not familiar with MSQuery, but if you limit the number of datasets to 8640 and you actually get more the immediate suspicion falls on the query. It seems - is that true? - that the fault only occurs when you refresh the data. Refreshing requires the same query to be run again. If the result is different the query should have been altered. So, one should look at the Refresh process which I presume not to be owned by Excel.
Once the data have been received by Excel they can be processed and modified by Excel, including VBA code that Excel might employ. Having too much data may be preferrable to having too few. If you know the rules by which the extra data are eliminated by MS Query you can apply the same rules to the raw data after Excel has received them. The better way would be to get MS Query to work the way you want. However, since you have come to an Excel forum we can try to give you an Excel solution.
So, how can we help you process the data you have in a workbook?
  • 0

Have a great day! :D

Sisyphus
I do this for "honour and country" - much less of the latter, actually.
If I helped you, award points, plenty of them.
If I bored you, deduct points for being too long-winded. (I know, :lol)
Sisyphus
Former Moderator
 
Posts: 4454
Joined: Dec 7, 2011
Location: Shanghai
Reputation: 203
Excel Version: 2010

Re: msqueries with in excel

Postby gabbie » Sun Jan 15, 2012 6:02 am

The data in the workbook has filled the sheet completely. I wish to limit it with vba code or a function in excel. I am unfamiliar with how to do this. Please assist if possible. Once I get control of this, I will then refresh on a time interval, which I believe can also be done in vba code.

I am learning as I go, so any information is appreciated.

Thanks
  • 0

gabbie
Rookie
 
Posts: 7
Joined: Jan 9, 2012
Reputation: 0

Re: msqueries with in excel

Postby Sisyphus » Sun Jan 15, 2012 7:34 pm

Hi gabbie,
Unfortunately, it is not possible to help you, unless you post something for us to look at. Usually, people "sterilize" their workbooks, and it would probably suffice to post 30 rows rather than 17,000. But, you must make the question clear and demonstrate your need by showing us what you want.
I don't know what you want but presume that you have a worksheet with more data in it than you need. Therefore you want to remove some of the data. Which data? All those with values less than zero in column B? All those in rows 8641 and up? All those dated a week ago or longer? Just narrow it down a little. :roll:
  • 0

Have a great day! :D

Sisyphus
I do this for "honour and country" - much less of the latter, actually.
If I helped you, award points, plenty of them.
If I bored you, deduct points for being too long-winded. (I know, :lol)
Sisyphus
Former Moderator
 
Posts: 4454
Joined: Dec 7, 2011
Location: Shanghai
Reputation: 203
Excel Version: 2010


Return to Macros and VBA Questions

Who is online

Users browsing this forum: Majestic-12 [Bot] and 243 guests