Excel VBA query with Date as field

Nicole1023

New Member
Joined
Sep 7, 2013
Messages
35
Hi,

I have a vba query that i would like to create a column for date. May I ask any idea on how to do this in my query. thanks.

below is my query: i wanted to include the todaydate as field column.

Code:
    TodayDate = Format(Date, "dd-mmm")
    
    sqlstr = "SELECT e.DAX_ITEMTYPE, e.DAX_WHSE, e.DAX_LOCATION "
    sqlstr = sqlstr & "FROM [1.reference$] e "
    sqlstr = sqlstr & "WHERE isnull(e.Location) "
    sqlstr = sqlstr & "GROUP BY e.DAX_ITEMTYPE, e.DAX_WHSE, e.DAX_LOCATION"
 

Some videos you may like

Excel Facts

Lock one reference in a formula
Need 1 part of a formula to always point to the same range? use $ signs: $V$2:$Z$99 will always point to V2:Z99, even after copying

Watch MrExcel Video

Forum statistics

Threads
1,109,487
Messages
5,529,154
Members
409,851
Latest member
Ingar
Top