B
Ben
Hi,
here is the macro s result.
Only when the result is not "", when the data is inserted in Range("A + the
variable, it creates a new column and put the data requested in.
Here is the part of the code:
***************************************************
....
Do Until Cells(R, 5) = "TOTAL:"
empty:
If Cells(R, 4) = "" Then
R = R + 1
Goto empty
End If
carte = cells(R, 4)
sqlstring = "select sum(temp) from BCV where Carte= '" & Carte & "'
connstring= "ODBC;DSN=DEV_DCI;UID=sa;PWD=abcde;Database=DV_DCI
With ActiveSheet.QueryTables.Add(Connection:=connstring , Destination:=
_Range("A" & R), Sql:=sqlstring)
.Refresh
End With
R = R + 1
Loop
....
************************************
Have seen a thread like that in this forum(With the keyword
"querytables.add) but the guy gave up. Me, I can'T!
Thank you.
here is the macro s result.
Only when the result is not "", when the data is inserted in Range("A + the
variable, it creates a new column and put the data requested in.
Here is the part of the code:
***************************************************
....
Do Until Cells(R, 5) = "TOTAL:"
empty:
If Cells(R, 4) = "" Then
R = R + 1
Goto empty
End If
carte = cells(R, 4)
sqlstring = "select sum(temp) from BCV where Carte= '" & Carte & "'
connstring= "ODBC;DSN=DEV_DCI;UID=sa;PWD=abcde;Database=DV_DCI
With ActiveSheet.QueryTables.Add(Connection:=connstring , Destination:=
_Range("A" & R), Sql:=sqlstring)
.Refresh
End With
R = R + 1
Loop
....
************************************
Have seen a thread like that in this forum(With the keyword
"querytables.add) but the guy gave up. Me, I can'T!
Thank you.