My workbook has a very large and growing number of rows, with a number of different codes doing all sorts of things. I had this working well but then I moved to Excel 2007, and now it has a problem........ Saved as .xlsm just stops and nothing works or if working it is very very very slow. When saved as .xls [Compatibility Mode) everything works except the following code.<?xml:namespace prefix = o ns = "urn:schemas-microsoft-comfficeffice" /><o></o>
<o></o>
I have debugged and I can see it copies the data to the new workbook (Columns A through to J), it puts the search parameters in the right cells (X2, Y2 and Z2) and actions the advance filter...... but only the column titles come over.. no data.. <o></o>
<o></o>
I have tried just "StartDate" and "Format(StartDate, "mm/dd/yyyy")" neither works.......... the date format in number of ways....but still no data...
Back with my old excel it worked so what am i doing wrong or should I be doing it another way......
<o></o>
I have debugged and I can see it copies the data to the new workbook (Columns A through to J), it puts the search parameters in the right cells (X2, Y2 and Z2) and actions the advance filter...... but only the column titles come over.. no data.. <o></o>
<o></o>
I have tried just "StartDate" and "Format(StartDate, "mm/dd/yyyy")" neither works.......... the date format in number of ways....but still no data...
Back with my old excel it worked so what am i doing wrong or should I be doing it another way......
Code:
Public StartDate
Public EndDate
Public AccountNumber
Public CancelProcess As Boolean
Public Sub SearchDataJournal()
Load frmGetJournal
frmGetJournal.Show
If CancelProcess Then Exit Sub
Dim ResultRowCount As Long
Const AccountColumn As Integer = 1
Const DateColumn As Integer = 10
Const DirectoryToSaveIn As String = "C:\Test\"
Application.ScreenUpdating = False
Dim shtActive As Worksheet
Set shtActive = ActiveSheet
With Workbooks.Add.Worksheets(1)
shtActive.Cells.Copy
.Range("A1").PasteSpecial xlPasteValues
Application.DisplayAlerts = False
Do While .Parent.Sheets.Count > 1
.Parent.Sheets(.Parent.Sheets.Count).Delete
Loop
Application.DisplayAlerts = True
End With
' Set up Criteria for advanced filter
Range("X1").Value = Cells(1, AccountColumn).Value
Range("Y1").Value = Cells(1, DateColumn).Value
Range("Z1").Value = Cells(1, DateColumn).Value
Range("X2").Value = AccountNumber
'Range("Y2").Value = ">=" & StartDate
Range("Y2").Value = ">=" & Format(StartDate, "mm/dd/yyyy")
'Range("Z2").Value = "<=" & EndDate
Range("Z2").Value = ">=" & Format(EndDate, "mm/dd/yyyy")
' Apply Advanced Filter
Columns("$A:$J").AdvancedFilter Action:=xlFilterCopy, _
CriteriaRange:=Range("$X$1:$Z$2"), CopyToRange:=Range("$AA$1"), Unique:=False
...... the code goes on and on