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