运行此 vba 代码时出现此错误。它的语法错误。请帮帮我。这是脚本。脚本所做的是,它将数据从一列复制到另一列并选择复制的列。
Set objExcel = CreateObject("Excel.Application")
objExcel.Visible = True
Set objWorkbook = objExcel.Workbooks.Open("C:\Users\pc\Report\report_20120912.xls")
Set ws = objWorkbook.Worksheets("Data")
Set SelRange = objExcel.Selection
ws.Range("F2:F1000").AdvancedFilter 2,,ws.Range("M2"),True
ws.Range("N1") = ws.Range("A1")
ws.Range("O1") = ws.Range("B1")
//Below line has the bug
ws.Range("M2").Select
selection=objExcel.Selection
col1=selection.End(xlDown) //showing error on this line
ws.Range(selection,col1).Select
n = ws.Range.Count
ws.Range("S2").Select