Tags: a2aq500, code, column, contains, date, excel, extract, following, microsoft, msdn, range, records, sheet1, software, table, vba

VBA Code to extract records between a date range

On Microsoft » Microsoft Excel

2,175 words with 3 Comments; publish: Fri, 23 May 2008 04:32:00 GMT; (306125.00, « »)

Hi there,

I was wondering if someone could help me with some code for the

following:

I have a table of data in Sheet1 (A2:AQ500).

Column A contains dates. Cell A1 contains a date that is a lower bound

and cell B1 contains a date that is an upper bound.

I would like some code that will find all the records with a date

between the lower and upper bounds and copy all these records to

Sheet2.

I figure I need some kind of loop. I'm ok with VBA but just not sure

how to start.

Thanks for any help anyone can offer.

David

All Comments

Leave a comment...

  • 3 Comments
    • In the interim, perhaps you might also wish to try out

      the non-array formulas play (using 2 formulas only)

      as responded to your earlier post in microsoft.public.excel

      --

      Rgds

      Max

      xl 97

      --

      Singapore, GMT+8

      xdemechanik

      http://savefile.com/projects/236895

      --

      #1; Fri, 23 May 2008 04:33:00 GMT
    • >(using 2 formulas only)

      You sure about that? <g>

      Does 21,956 sound more like it?

      With that many formulas I would drop the error trap and go with CF.

      Biff

      "Max" <demechanik.excel.todaysummary.com.yahoo.com> wrote in message

      news:OIhXaSnvFHA.2728.excel.todaysummary.com.TK2MSFTNGP14.phx.gbl...

      > In the interim, perhaps you might also wish to try out

      > the non-array formulas play (using 2 formulas only)

      > as responded to your earlier post in microsoft.public.excel

      > --

      > Rgds

      > Max

      > xl 97

      > --

      > Singapore, GMT+8

      > xdemechanik

      > http://savefile.com/projects/236895

      > --

      >

      #2; Fri, 23 May 2008 04:34:00 GMT
    • > (using 2 formulas only)

      > You sure about that? <g>

      Of course, I meant 2 "starting" cell formulas,

      filled down / across & down <g>

      Albeit subjective, the recalc's performance for the OP's situation does

      appear quite tolerable going by the full formula loading test here ..

      --

      Rgds

      Max

      xl 97

      --

      Singapore, GMT+8

      xdemechanik

      http://savefile.com/projects/236895

      --

      #3; Fri, 23 May 2008 04:35:00 GMT