代码行不工作。 不知道为什么?

我find了一种方法来根据标准在电子表格中获取新信息。 我的问题是一行,给我一个应用程序定义或对象定义的错误。 我不知道为什么会这样。 这个代码做什么的解释是在评论中。 任何帮助表示赞赏! 提前致谢。

Public Sub Check_Price_Click() 'This code block runs through the data and if the first column is equal to the current date and the third column is equal to a Brand 'then copy new data to different workbook and repeat Dim LastRow As Integer, i As Integer, erow As Integer 'This line of code is not working LastRow = ActiveSheet.Range(“A” & Rows.Count).End(xlUp).Row For i = 2 To LastRow If Cells(i, 1) = Date And Cells(i, 3) = Cells(i, 3).Value Then Range(Cells(i, 1), Cells(i, 157)).Select Selection.Copy Workbooks.Open Filename:="C:\Users\Sales1\Dropbox\Davids Files\Macro Work\Daily Progress.xlsx" Worksheets(“Sheet1”).Select erow = ActiveSheet.Cells(Rows.Count, 1).End(xlUp).Offset(1, 0).Row ActiveSheet.Cells(erow, 1).Select ActiveSheet.Paste ActiveWorkbook.Save ActiveWorkbook.Close Application.CutCopyMode = False End If Next i End Sub 

A周围的引号不是正确的字符。 将它们replace为Enter键旁边的双引号。

另外,在'A'之后立即包含Rows.Count的ActiveSheet引用。

那些引用看起来对我来说是异乎寻常的

你有以下几点:

 Range(“A” & Rows.Count) ^ ^ ---¦ ¦--- ¦ ¦ Chr(147) Chr(148) 

那些实际上是Chr(147)Chr(148) – 你需要的是" Chr(34)