ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   can I use some Qwery to populate the sheet with the data from pre. (https://www.excelbanter.com/excel-programming/315674-can-i-use-some-qwery-populate-sheet-data-pre.html)

[email protected]

can I use some Qwery to populate the sheet with the data from pre.
 
Can I populate the sheet with the data from a different sheet of the book
based on the value of the data on the sheet from one of the columns.
Something like
INsert into .....
select * from ....
where ....

Tom Ogilvy

can I use some Qwery to populate the sheet with the data from pre.
 
Possibly using Data = Filter = Advanced Filter

--
Regards,
Tom Ogilvy

" wrote
in message ...
Can I populate the sheet with the data from a different sheet of the book
based on the value of the data on the sheet from one of the columns.
Something like
INsert into .....
select * from ....
where ....




ob3ron02[_19_]

can I use some Qwery to populate the sheet with the data from pre.
 

If i understand your question, what you're looking to do is build
query based on cell input?

If you were looking for the query "Select mycolumn from mytable wher
mycolumn like = mystring" where all the "my" variables are taken fro
cell input you could do the following.

Dim mycolumn, mytable, mycondition As String
Dim querystring As String

mycolumn = [Sheet1!A1] <--- lets say the cell contains "age"
mytable = [Sheet1!A2] <---- lets say the cell contains "family"
mycondition = [Sheet1!A3] <---- lets say the cell contains "85"

querystring = "Select " & mycolumn & " from " & mytable & " where "
mycolum & " like " & mycondition

You'd then get querystring as "Select age from family where age lik
85". So all you need to do is just pass the querystring string t
whatever mechanism performs your query. Of course you can get muc
creative than in taking the user's input but that gives you a basi
idea of how to do it using cells for input

--
ob3ron0
-----------------------------------------------------------------------
ob3ron02's Profile: http://www.excelforum.com/member.php...fo&userid=1545
View this thread: http://www.excelforum.com/showthread.php?threadid=27498


ob3ron02[_20_]

can I use some Qwery to populate the sheet with the data from pre.
 

Hahah wow i totally misunderstood your question. Sorry

--
ob3ron0
-----------------------------------------------------------------------
ob3ron02's Profile: http://www.excelforum.com/member.php...fo&userid=1545
View this thread: http://www.excelforum.com/showthread.php?threadid=27498



All times are GMT +1. The time now is 12:11 PM.

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