VBA在msg框中打印一个值

我被困在学校的任务,这是我必须做的:

这是我现在的代码:

你需要循环你已经加载的数组,并且:

Sub Ratio() Dim OperatingRatio() As Double Dim j As Long With Sheets("Summary") OperatingRatio = .Cells("I80:M80").Value For j = LBound(OperatingRatio, 2) To UBound(OperatingRatio, 2) If OperatingRatio(1, j) > 100 Then MsgBox .Cells(14, 9 + j) .Cells(80, 9 + j).Interior.Color = vbRed Else End If Next j End With End Sub 

如果你循环遍历所有单元格,比如:

 Dim i As Integer '9 means column I and 13 is column M For i = 9 To 13 ' Getting the percent values Debug.Print Worksheets("Summary").Cells(80, i).Value Next 

这样你可以自己继续。