Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I wish to include cell reference as parameters to a Data Import module that
I have recorded but not sure of the syntax. What I have recorded works great but when I want to modify the dates I have to change the hard code. My dates within the macro are currently between 31/05/2004 and todays date. Say if a cell reference exists for 31/5/2004 in Sheet(Sales) Range C5 - how could I incorporate that below so that my Data Import could update to whatever date is in Sale C5 Thanks Sub PullSales() Sheets("Database2").Select With ActiveSheet.QueryTables.Add(Connection:=Array(Arra y( _ "ODBC;DBQ=E:\JIM1_be.mdb;DefaultDir=E:\;Driver={Mi crosoft Access Driver (*.mdb)};DriverId=281;FIL=MS Access;MaxBufferSize=2048;MaxSca" _ ), Array( _ "nRows=8;PageTimeout=5;SafeTransactions=0;Threads= 3;UID=admin;UserCommitSync =Yes;" _ )), Destination:=Range("A1")) .CommandText = Array( _ "SELECT tblStoreTotals.StoreNo, tblStoreTotals.SalesDate, tblStoreTotals.TaxableSales" & Chr(13) & "" & Chr(10) & "FROM `E:\OKR1_be`.tblStoreTotals tblStoreTotals" & Chr(13) & "" & Chr(10) & "WHERE (tblStoreTotals.SalesDate={ts '2004-05-31 00:00:00'})" & Chr(13) & "" & Chr(10) & "ORD" _ , "ER BY tblStoreTotals.StoreNo, tblStoreTotals.SalesDate") .Name = "Query from Pull Sales" .FieldNames = True .RowNumbers = False .FillAdjacentFormulas = False .PreserveFormatting = True .RefreshOnFileOpen = False .BackgroundQuery = True .RefreshStyle = xlInsertDeleteCells .SavePassword = True .SaveData = True .AdjustColumnWidth = True .RefreshPeriod = 0 .PreserveColumnInfo = True .Refresh BackgroundQuery:=False End With End Sub |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Change import cell reference | Excel Worksheet Functions | |||
Import data from 1 cell on 1 worksheet to othr cell(s) in another | Excel Worksheet Functions | |||
how do i reference a cell with url for web query import? | Excel Worksheet Functions | |||
Help to import data from reference workbook | Excel Discussion (Misc queries) | |||
Import Data into same cell | Excel Discussion (Misc queries) |