1
我想跨我的工作簿中的多个数据表运行此宏,但我不能让代码跨工作簿正常运行。如果我在单张纸上运行宏,它可以正常运行,但我现在试图运行所有纸张,并排除“数据”和“更新”表,并且如果有任何关于如何解决的问题,通过所有工作表正常运行?由于运行宏多个工作表排除
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
这个工作谢谢 – Nrandazzo