Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.misc
|
|||
|
|||
Destination range
Rows 1,2,3 have input controls for the user.
When I execute the following, it is supposed to return the data to range=A4, instead, it inserts 5 columns of data at A1. Private Sub CommandButton1_Click() ' do query using dates from B1, B2 ' NOTE: need to adjust dates by subtracting 36161 to match up with date values Dim qt As QueryTable sqlstring = "SELECT INVOICE, CUSTOMERNAME, ITEM_REC, QUANTITY, AMOUNT FROM TRANSACT" connstring = "ODBC;DSN=Odyssey" Set qt = ActiveSheet.QueryTables.Add(Connection:=connstring , Destination:=ActiveSheet.Range("A4")) qt.FillAdjacentFormulas = True qt.CommandText = sqlstring qt.CommandType = xlCmdSql qt.Destination.ClearContents qt.Refresh End Sub How do I get it to return the results to the location I specify? |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Duplicate Range Names by worksheet | Excel Discussion (Misc queries) | |||
checking that cells have a value before the workbook will close | Excel Worksheet Functions | |||
Help with using range names in sum function | Excel Worksheet Functions | |||
can a formula check for a certain value in a range? | Excel Discussion (Misc queries) | |||
Counting empty cells within a range of cells | New Users to Excel |