【发布时间】:2016-05-23 13:37:54
【问题描述】:
我有一个 40 张工作簿,其中 30 张设置了相同的 Excel 表格。我需要一个宏,它将在“计费月数”列的表格范围内的 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
【问题讨论】: