我正在尝试在我的工作簿中的多个数据表中运行此宏,但我无法让代码在工作簿中正确运行。如果我在单张纸上运行宏,它工作正常,但我现在尝试运行所有工作表并排除“数据”和“更新”工作表并且没有任何运气,如果有任何关于如何操作的建议,代码如下正确运行所有工作表?谢谢
Sub UpdatePrices()
Dim ws As Worksheet, Ldate As String, DateRng As Range
Set DateRng = Range("A3") 'date range is last date
Ldate = DateRng.Value 'defines ldate as most recent date
For Each ws In ActiveWorkbook.Worksheets
'Inserts a new row with containing today's Date and exclude sheets
If Ldate <> Date And ws.Name <> "DATA" Or ws.Name <> "UPDATE" Then
DateRng.EntireRow.Insert
DateRng.Offset(-1, 0) = "=TODAY()"
Else
End If
Next ws
End sub