我有一個工作簿40個工作表,其中30個工作表具有相同的Excel表格設置。我需要一個宏,它將在「Months Billed」列中的表格範圍內的30張表格內增加1。我已經試過這在一張紙上工作的關注 - 但不確定如何有多個工作表同樣的工作 - 我也不需要消息框:在多個工作表上增加範圍中的單元格值一個爲
Sub MonthIncrease()
Dim r1 As Range
Dim cell As Range
Set r1 = Sheets("Customer 1").Range("Customer1[Months Billed]")
For Each cell In r1
If IsNumeric(cell.Value) Then
If cell.Value > 0 Then
cell.Value = cell.Value + 1
End If
Else
MsgBox "Cell " & cell.Address(0, 0) & " does not have a number"
Exit Sub
End If
Next
End Sub