请教excel vba的单元格作为参数问题
山水无言 2019-09-30 06:50:57 请教,excel vba将一个单元格的值作为参数的过程怎么写?一个单元格的值要传递给这个过程,调用函数怎么写?谢谢!!!
例如,h1单元格的值为9,请问怎么将这个9传给下面过程?
过程如下:
Sub change__bgcolor(gs As Range)
Dim f9 As Integer
Dim i, j, r, c As Integer
r = 9 '最后一行
c = 2 '最后一列
f9 = gs.Value 'Cells(1, 6)
Range(Cells(1, 1), Cells(9, 2)).Interior.ColorIndex = 0
For i = 1 To r
If f9 >= 6 Then
If Cells(i, 2) <= 3 Then
Range(Cells(i, 1), Cells(i, 2)).Interior.ColorIndex = 42
End If
End If
Next
End Sub