Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

selecting dynamic data

Status
Not open for further replies.

smurf01

IS-IT--Management
Jul 6, 2002
470
GB
I have a worksheet that returns data from a microsoft query, this data is dynamic and therefore the row count can change whenever the query is run. what i am trying to do is to select all the current data in a selected range and use paste special to return the values into another workshheet, the columns will always be the same i.e.(B2:H2)and also the starting row i.e.(B3) however the final row will not i.e. (could be B66, or B102 or B140 etc.)how can i do this

Regards

Paul
 
If you click anywhere in the returned data, and then goto Data>Get External Data>Data Range Properties, you should be able to see a textbox that shows a name for the data range
change this to whatever you want and then reference it as you would a defined range name
eg
Range("MyDataRange").select
This range name will refer to whatever data has been returned and the parameters are reset every time the query is run and therefore is dynamic with the query and therefore, using the above syntax you can always select your entire query range
Note: There are ome other, very useful properties in there as well such as fill down adjacent formulae to the bottom of the new dataset - absolutely invaluable Rgds
~Geoff~
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top