Wierd Date listbox behaviour

M

Merlynsdad

I have two date listboxes, a FROM and a TO, so the user can select a date
range. The dates start 10/1/09 and continue until today. If I select a date
range greater than 26 days, I get an error message on the paste command. I'm
using this same paste command in several other listboxes without a problem.
The code is as follows:

Windows(cstrDBfile).Activate
Set ws = Sheets("DCI data")
ws.Activate
ws.Range("$b$6").Activate
ws.Range("b6").AutoFilter field:=2, Criteria1:=">=" &
CDate(lstFrom), Criteria2:="<=" & CDate(lstTo)

'Copy the query results to the Query tab in this workbook

ActiveSheet.Cells.Select
Selection.Copy
ActiveSheet.Range("a1").End(xlDown).Offset(1, 0).Select
Me.Activate
ActiveWorkbook.Sheets("QueryDate").Select
Range("$a$16").Select
Selection.PasteSpecial Paste:=xlPasteValues, operation:=xlNone,
skipblanks _
:=False, Transpose:=False

Any help will be appreciated.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top