excel - Move sequentially through a date range -
so i'm in bit of jam. want grab bunch of data using sql , list on excel chart. however, need list date, so:
date | data 2015-05-19 | 62 2015-05-20 | 30 2015-05-21 | 78
getting data easy enough, need move through date range (2015-05-19 2015-05-21, example), listing every date have , sorting data based on dates. if have date range above, need sequentially move through each date in range, , list current value on excel sheet.
anyone know how this? sorry if it's not explained, i'm not having easy time wrapping head around it.
this using adodb , access database may have alter things fit needs. it's in sheet1 module.
sub test() dim cnn adodb.connection dim rs adodb.recordset set cnn = getconnection() 'however create connection set rs = cnn.execute("select yourdate, yourdata yourtable yourdate > #5/19/2015# , yourdate < #5/21/2015# order yourdate") me.range("a2").copyfromrecordset rs 'this doesn't include fields names rs.close end sub
Comments
Post a Comment