我正在编写循环代码以运行如下所示的简单功能:
Option Explicit
Dim num As Variant
Dim sh1 As Range, sh2 As Range, sh3 As Range, sh4 As Range, multirange1 As Range, multirange2 As Range
Dim i As Integer, j As Integer, k As Integer, sht As Worksheet, LastRow As Long
Set sht = ActiveSheet
LastRow = sht.cells(sht.Rows.Count, "A").End(xlUp).Row
For i = 6 To LastRow
For j = 2 To 11
For k = 15 To 24
sht.Range.cells(i, k).Value = sht.Range.cells(i, j).Value / sht.Range.cells(6, j).Value
Selection.NumberFormat = "0.00%"
If Range("N" & i).Font.Bold = True Then
Range("O" & i & ":X" & i).Font.Bold = True
Else
Range("O" & i & ":X" & i).Font.Bold = False
End If
Next i
但是,vba在此行给我argument not optional
错误
sht.Range.cells(i, k).Value = sht.Range.cells(i, j).Value / sht.Range.cells(6, j).Value
。
如果有人能给我一些建议,以使这段代码以更快的速度运行,并且以相同的效率运行得更快,我真的很感激。
非常感谢您的帮助,因为我是vba的初学者。