ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Extract MS Query Cell Address (https://www.excelbanter.com/excel-programming/403079-extract-ms-query-cell-address.html)

ExcelMonkey

Extract MS Query Cell Address
 
When I Import Data (MS Query) into my spreadsheet is asks for destination
cell. Is it possible to extract this cell address from the MS Query object
after-the-fact?

Thanks
EM

joel

Extract MS Query Cell Address
 
The querry Name and Range becomes a defined Name on the worksheet. You can
view the range on the worksheet by going to menu and doing the following

File - Properties - Contents


Use this VBA code to see all names including querry name

For Each myname In ThisWorkbook.Names
MsgBox (myname.Name & " Range is : " & myname)
Next myname:

When I Import Data (MS Query) into my spreadsheet is asks for destination
cell. Is it possible to extract this cell address from the MS Query object
after-the-fact?

Thanks
EM


ExcelMonkey

Extract MS Query Cell Address
 
This almost gets me there but I will need a way to differentiate between the
named cells. Don't think there is a way to do that.

EM

"Joel" wrote:

The querry Name and Range becomes a defined Name on the worksheet. You can
view the range on the worksheet by going to menu and doing the following

File - Properties - Contents


Use this VBA code to see all names including querry name

For Each myname In ThisWorkbook.Names
MsgBox (myname.Name & " Range is : " & myname)
Next myname:

When I Import Data (MS Query) into my spreadsheet is asks for destination
cell. Is it possible to extract this cell address from the MS Query object
after-the-fact?

Thanks
EM


Tim Zych

Extract MS Query Cell Address
 
Dim rng as range
set rng = ActiveSheet.QueryTables(1).ResultRange
msgbox rng.Cells(1, 1).Address

--
Tim Zych
SF, CA

"ExcelMonkey" wrote in message
...
When I Import Data (MS Query) into my spreadsheet is asks for destination
cell. Is it possible to extract this cell address from the MS Query
object
after-the-fact?

Thanks
EM





All times are GMT +1. The time now is 10:02 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com