Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Junior Member
 
Posts: 2
Default Macro code to reference a cell for a date parameter when pulling data

I have this code:


& "AND (matter.mmatter Like '" & Sheets("Parameters").Range("C17").Value & "')" & Chr(13) & "" & Chr(10) & "AND (timecard.ttk Like '" & Sheets("Parameters").Range("C19").Value & "')" & Chr(13) & "" & Chr(10) & "AND (timecard.tworkdt={ts '2012-01-01 00:00:00'}) " & Chr(13) & "" & Chr(10) & "AND (timecard.tworkdt<={ts '2012-01-31" _
, " 00:00:00'})")

It works fine, but I want the date part:

"AND (timecard.tworkdt={ts '2012-01-01 00:00:00'}) "

to reference a cell in the worksheer (ie D5) instead of been fixed.
ANy help will be appreciated.
Thanks!
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 538
Default Macro code to reference a cell for a date parameter when pulling data

JAlvarez wrote:

I have this code:


& "AND (matter.mmatter Like '" & Sheets("Parameters").Range("C17").Value
& "')" & Chr(13) & "" & Chr(10) & "AND (timecard.ttk Like '" &
Sheets("Parameters").Range("C19").Value & "')" & Chr(13) & "" & Chr(10)
& "AND (timecard.tworkdt={ts '2012-01-01 00:00:00'}) " & Chr(13) & "" &
Chr(10) & "AND (timecard.tworkdt<={ts '2012-01-31" _
, " 00:00:00'})")

It works fine, but I want the date part:

"AND (timecard.tworkdt={ts '2012-01-01 00:00:00'}) "

to reference a cell in the worksheer (ie D5) instead of been fixed.
ANy help will be appreciated.


Try something like this:
"AND (timecard.tworkdt=" & Range("D5").Value
or:
"AND (timecard.tworkdt=" & Cells(5, 4).Value

--
I have come here to chew memory and kick ass...
and malloc() is returning a null pointer.
Reply
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
Get cell reference as parameter in function RSunday Excel Programming 3 February 15th 08 06:46 PM
How 2 Link DATA instead of CELL REFERENCE - Pulling My Hair Out! NineuhtOK New Users to Excel 6 June 8th 07 10:44 PM
help with passing date to access as parameter query(code included) Vince Excel Programming 2 December 10th 06 03:15 AM
Excel, reference a cell for parameter in SQL to import data Wizard Excel Programming 4 June 16th 06 01:04 PM
Data_field parameter in getpivotdtata as a cell reference. Tomas Excel Discussion (Misc queries) 1 July 22nd 05 03:18 AM


All times are GMT +1. The time now is 12:21 PM.

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

About Us

"It's about Microsoft Excel"