P
Poogy
Hi all,
I really need your advice please!!
I'm trying to build an application that's main purpose is to perform
several Advanced Filter actions on an Excel sheet.
the idea is to open an xls file of report, and to split the data to
new sheets within the same workbook, by automating this simple
operation.
i recorded a macro which works perfect on specific spreadsheet, but
doesn't work as part of my application, to enable working with any
other spreadsheet.
Since my problem is (mainly) in the function Advanced Filter, can u
please tell me what's wrong with this code??
' open the file in excel
Dim xlApp As Object
Set xlApp = CreateObject("excel.application")
xlApp.Visible = True
xlApp.Workbooks.Open ("C:\Projects\myreport.xls")
' add new sheet
xlApp.Sheets.Add
xlApp.Sheets("Sheet1").Select
xlApp.Sheets("Sheet1").Name = "mySheet"
' perform advanced filter on the original worksheet (now it's
number 2)
xlApp.Worksheets(2).Range("A1").CurrentRegion.AdvancedFilter _
Action:=xlFilterCopy,
CriteriaRange:=xlApp.Worksheets(2).Range("K1:K2"),
CopyToRange:=xlApp.Worksheets(2).Range("A500")
if there's any other way to perform it, please reply...
almost desperate....
Poogy
I really need your advice please!!
I'm trying to build an application that's main purpose is to perform
several Advanced Filter actions on an Excel sheet.
the idea is to open an xls file of report, and to split the data to
new sheets within the same workbook, by automating this simple
operation.
i recorded a macro which works perfect on specific spreadsheet, but
doesn't work as part of my application, to enable working with any
other spreadsheet.
Since my problem is (mainly) in the function Advanced Filter, can u
please tell me what's wrong with this code??
' open the file in excel
Dim xlApp As Object
Set xlApp = CreateObject("excel.application")
xlApp.Visible = True
xlApp.Workbooks.Open ("C:\Projects\myreport.xls")
' add new sheet
xlApp.Sheets.Add
xlApp.Sheets("Sheet1").Select
xlApp.Sheets("Sheet1").Name = "mySheet"
' perform advanced filter on the original worksheet (now it's
number 2)
xlApp.Worksheets(2).Range("A1").CurrentRegion.AdvancedFilter _
Action:=xlFilterCopy,
CriteriaRange:=xlApp.Worksheets(2).Range("K1:K2"),
CopyToRange:=xlApp.Worksheets(2).Range("A500")
if there's any other way to perform it, please reply...
almost desperate....
Poogy