LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 141
Default Data Import Cell Reference

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Change import cell reference AMaleThing Excel Worksheet Functions 3 June 4th 08 04:04 PM
Import data from 1 cell on 1 worksheet to othr cell(s) in another BCassedy Excel Worksheet Functions 1 July 19th 07 10:50 AM
how do i reference a cell with url for web query import? fkendrick Excel Worksheet Functions 1 January 2nd 07 12:23 PM
Help to import data from reference workbook JackSpam Excel Discussion (Misc queries) 2 July 20th 05 02:37 AM
Import Data into same cell ib_redbeard Excel Discussion (Misc queries) 3 March 1st 05 12:08 PM


All times are GMT +1. The time now is 03:06 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"