我有一个工作簿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