![]() |
read string from database and divide result into cells?
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 |
read string from database and divide result into cells?
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 |
read string from database and divide result into cells?
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? |
read string from database and divide result into cells?
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 |
read string from database and divide result into cells?
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 |
read string from database and divide result into cells?
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 |
read string from database and divide result into cells?
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) |
read string from database and divide result into cells?
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 |
All times are GMT +1. The time now is 01:57 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com