Scrap
03-14-2005, 11:47 AM
Hello, here is my problem:
it seems like the range("A + the variable" get confused when datas are add on the sheet.
The visual result is in the attachment.
Do Until Cells(R, 5) = "TOTAL:"
vide:
If Cells(R, 4) = "" Then
R = R + 1
GoTo vide
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=DE V_DCI
With ActiveSheet.QueryTables.Add(Connection:=connstring , Destination:=
_Range("A" & R & "), Sql:=sqlstring)
.Refresh
End With
R = R + 1
Loop
Thank you.
it seems like the range("A + the variable" get confused when datas are add on the sheet.
The visual result is in the attachment.
Do Until Cells(R, 5) = "TOTAL:"
vide:
If Cells(R, 4) = "" Then
R = R + 1
GoTo vide
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=DE V_DCI
With ActiveSheet.QueryTables.Add(Connection:=connstring , Destination:=
_Range("A" & R & "), Sql:=sqlstring)
.Refresh
End With
R = R + 1
Loop
Thank you.