-2
我遇到过麻烦循环我对于这个VBA - 通过子循环FOR/if语句
Dim c As Range, color As Integer, y As Integer
Sheets("Point Names").Select
numpts = Range("A2", Range("A2").End(xlDown)).Rows.Count
y = x
With Sheets("Reporting")
For y = 1 To numpts
Set c = Range("C" & (12 * y - 2))
For color = c To Range(c, Range(c).End(xlToRight)).Columns.Count
If Cells(color).FormulaR1C1 = "=Abs(R[-2]C-R[-1]C)/R[-1]C)" _
> ToleranceMean * ActiveCell.Offset(-1, 0) Then
Cells(color).Interior.color = RGB(255, 0, 0)
End If
Next color
Next y
End With
我的目标是获得在该线位于公差外的意思是红色的每一个单元,Change in Temp
声明。
在此先感谢。
这是什么做的是错误的。这里没有问题。 –
你的问题是什么?我相信,如果你的数据以左上角的'A1'开始,你的'numpts'将始终为'2'。也许想用'A3'作为计数的范围? – BruceWayne
我把一个更好的图片来描述它。它只是没有适当的循环。另外还有不同数量的这样的分组。对于这个特定的例子,还有10个这样的其他分组。 –