ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Wierd Date listbox behaviour (https://www.excelbanter.com/excel-programming/435812-wierd-date-listbox-behaviour.html)

Merlynsdad

Wierd Date listbox behaviour
 
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.


All times are GMT +1. The time now is 03:27 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com