Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Using the values in range of cells in an SQL query
I would like to use the values of a range of cells in an SQL query, but
I'm not sure the best way to do it. Basically, the value of each cell would be part of a string, each separated by a comma. I could build an array to loop through each value in the range and append a comma, but is there a simpler way? Thank you for your time. |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Using the values in range of cells in an SQL query
Demo'd from the immediate window:
v = Application.Transpose( _ Application.Transpose(range("A1").Resize(1,5))) s = Join(v,",") ? s AA,BB,CC,DD,EE if the cells are in a column, you only need one Application.Transpose -- Regards, Tom Ogilvy "steveh" wrote: I would like to use the values of a range of cells in an SQL query, but I'm not sure the best way to do it. Basically, the value of each cell would be part of a string, each separated by a comma. I could build an array to loop through each value in the range and append a comma, but is there a simpler way? Thank you for your time. |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Using the values in range of cells in an SQL query
Thanks, Tom. That worked great. I just had to use WorksheetFunction
instead of Application. Tom Ogilvy wrote: Demo'd from the immediate window: v = Application.Transpose( _ Application.Transpose(range("A1").Resize(1,5))) s = Join(v,",") ? s AA,BB,CC,DD,EE if the cells are in a column, you only need one Application.Transpose |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Using the values in range of cells in an SQL query
You shouldn't have to - afterall, "demo'd from the immediate window" means
the code was successfully executed. But if it works, I don't see a problem with that. -- Regards, Tom Ogilvy "steveh" wrote in message ... Thanks, Tom. That worked great. I just had to use WorksheetFunction instead of Application. Tom Ogilvy wrote: Demo'd from the immediate window: v = Application.Transpose( _ Application.Transpose(range("A1").Resize(1,5))) s = Join(v,",") ? s AA,BB,CC,DD,EE if the cells are in a column, you only need one Application.Transpose |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
calculate values in an unlimited range of cells in a column WITHOUTalso calculating values that had previously been filtered AGAINST? | Excel Discussion (Misc queries) | |||
Query to take values from Cells | Excel Discussion (Misc queries) | |||
Database query with a range of cells as paramters? | Excel Discussion (Misc queries) | |||
There must be a way!!!--set cells' values equal to calculated values in another range | Excel Programming | |||
loop through cells in a range and pick up corresponding cell values in another range | Excel Programming |