Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 23
Default Finding the query range

Hello All

I run a database query from Excel that populates data starting at D11
as follows:

Range("D11").Select
Selection.QueryTable.Refresh BackgroundQuery:=False



Now I want to know what range of cells in the worksheet have been
populated by the query how can we find it ?.

I looked for various functions on the QueryTable I cannot find any
information on how to obtain the Worksheet range that the QueryTable
as populated can you please let me know how I can find the worksheet
range populated by the QueryTable.

Thanks
Belinda
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Finding the query range

range("D11").CurrentRegion

should do it.

but more specifically

Activesheet.queryTables("Table1").ResultRange

--
Regards,
Tom Ogilvy




"Belinda" wrote in message
om...
Hello All

I run a database query from Excel that populates data starting at D11
as follows:

Range("D11").Select
Selection.QueryTable.Refresh BackgroundQuery:=False



Now I want to know what range of cells in the worksheet have been
populated by the query how can we find it ?.

I looked for various functions on the QueryTable I cannot find any
information on how to obtain the Worksheet range that the QueryTable
as populated can you please let me know how I can find the worksheet
range populated by the QueryTable.

Thanks
Belinda



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 29
Default Finding the query range

Belinda,

Is this what you mean?

Dim endcell As Range, LastRow As Long, lastColumn As Byte

LastRow =
ActiveSheet.UsedRange.Rows(ActiveSheet.UsedRange.R ows.Count).Row
lastColumn =
ActiveSheet.UsedRange.Columns(ActiveSheet.UsedRang e.Columns.Count).Column

Debug.Print "Querytable Range is " & Range("D11:" & Cells(LastRow,
lastColumn).Address).Address



--
HTH
Roger
Shaftesbury (UK)





"Belinda" wrote in message
om...
Hello All

I run a database query from Excel that populates data starting at D11
as follows:

Range("D11").Select
Selection.QueryTable.Refresh BackgroundQuery:=False



Now I want to know what range of cells in the worksheet have been
populated by the query how can we find it ?.

I looked for various functions on the QueryTable I cannot find any
information on how to obtain the Worksheet range that the QueryTable
as populated can you please let me know how I can find the worksheet
range populated by the QueryTable.

Thanks
Belinda



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Finding the Access query a pivot table is based on ChuckW Excel Discussion (Misc queries) 1 March 21st 08 04:13 PM
finding a value between a range Susan Excel Worksheet Functions 9 March 6th 07 12:07 AM
Excel not finding the server in web query JM Excel Discussion (Misc queries) 0 February 12th 06 10:46 PM
finding name within range sheila Excel Worksheet Functions 4 September 14th 05 07:52 AM
finding if name within range sheila Excel Worksheet Functions 9 September 13th 05 04:24 AM


All times are GMT +1. The time now is 07:59 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"