Hi,
Need some desperate help.
I am trying to grab some data from a database and throw it onto my Excel sheet followed by some manipulation. Earlier I thought I can just set up a query once and then refresh the data each time I run the macro, so I added the following two lines to my macro:
Sheets("BoardUs age").Select
Selection.Query Table.Refresh BackgroundQuery :=False
("BoardUsage " is the name of the worksheet where I pasted the data the first time I ran the query)
But now, when I refresh the data, the data is incorrect somehow. So I was wondering whether I need to run the original query each time? And if so can I add a code for that in VBA so that I get the exact fields that I need along with the search criteria I had the first time? Can someone help me with this?
(Sorry guys, I am VB and SQL illiterate and am used to recording macros)
Thanks in advance.
Need some desperate help.
I am trying to grab some data from a database and throw it onto my Excel sheet followed by some manipulation. Earlier I thought I can just set up a query once and then refresh the data each time I run the macro, so I added the following two lines to my macro:
Sheets("BoardUs age").Select
Selection.Query Table.Refresh BackgroundQuery :=False
("BoardUsage " is the name of the worksheet where I pasted the data the first time I ran the query)
But now, when I refresh the data, the data is incorrect somehow. So I was wondering whether I need to run the original query each time? And if so can I add a code for that in VBA so that I get the exact fields that I need along with the search criteria I had the first time? Can someone help me with this?
(Sorry guys, I am VB and SQL illiterate and am used to recording macros)
Thanks in advance.