Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I would like to read a string based on a db query (like select Names
from NameTable where Name Like '%James%') and take each resulting string and devide then into different cells... E.g. James Hansson - A1=James and B1=Hansson How can this be done? I can get as far as using querytables and show the results in the current sheet but thats not what I want. //Ladyhawke |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
if James Hansson is in A1, then
=LEFT(A1,FIND(" ",A1)-1) will give you James and =RIGHT(A1,LEN(A1)-FIND(" ",A1)) will give you Hansson or you could use the Text to Columns feature. -- Gary's Student "ladyhawke" wrote: I would like to read a string based on a db query (like select Names from NameTable where Name Like '%James%') and take each resulting string and devide then into different cells... E.g. James Hansson - A1=James and B1=Hansson How can this be done? I can get as far as using querytables and show the results in the current sheet but thats not what I want. //Ladyhawke |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Ok, that will work if my string is in a cell...
I would like i VBA to fetch a string result from Database and split the string before showing the data in cells... Do you know how? |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
On 29 Jun 2006 02:36:09 -0700, "ladyhawke" wrote:
Ok, that will work if my string is in a cell... I would like i VBA to fetch a string result from Database and split the string before showing the data in cells... Do you know how? Use the SPLIT function in VBA --ron |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Had the same idea but I'm a newbie here and I don't even know how to
fetch the string directly from the VBA code instead of my current roundtrip to a cell.... Ron Rosenfeld skrev: On 29 Jun 2006 02:36:09 -0700, "ladyhawke" wrote: Ok, that will work if my string is in a cell... I would like i VBA to fetch a string result from Database and split the string before showing the data in cells... Do you know how? Use the SPLIT function in VBA --ron |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
On 30 Jun 2006 03:18:59 -0700, "ladyhawke" wrote:
Had the same idea but I'm a newbie here and I don't even know how to fetch the string directly from the VBA code instead of my current roundtrip to a cell.... Ron Rosenfeld skrev: On 29 Jun 2006 02:36:09 -0700, "ladyhawke" wrote: Ok, that will work if my string is in a cell... I would like i VBA to fetch a string result from Database and split the string before showing the data in cells... Do you know how? Use the SPLIT function in VBA --ron It's hard to advise as you give little information about what you are doing now. How are you getting it into the cell now? --ron |
#7
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I fetch the ruslts like this for now:
With ActiveSheet.QueryTables.Add(Connection:=...... With a query that fetches several strings but I can easily make that just one result. My issue is that I'm just starting out in the VBA department so I dont know how to open a database connection, store the result in a string variable and the do the splitting returning the results to various cells. The latter part is not a big problem since I've got some ideas from this question and som on my own :o) |
#8
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
On 1 Jul 2006 00:58:20 -0700, "ladyhawke" wrote:
I fetch the ruslts like this for now: With ActiveSheet.QueryTables.Add(Connection:=...... With a query that fetches several strings but I can easily make that just one result. My issue is that I'm just starting out in the VBA department so I dont know how to open a database connection, store the result in a string variable and the do the splitting returning the results to various cells. The latter part is not a big problem since I've got some ideas from this question and som on my own :o) There are more knowledgeable people here that can advise you regarding the database connection issue. That's not something I've played around with much. Perhaps if you reposted with a Subject that only mentions the database connection issue, one of those gurus will take notice. --ron |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
divide a string words separated by (number) | Excel Discussion (Misc queries) | |||
read database | Excel Programming | |||
Divide comma-separated string and look up corresponding category | Excel Programming | |||
Divide comma-separated string and look up corresponding category | Excel Programming | |||
Divide comma-separated string and look up corresponding category | Excel Programming |