想实现如下功能:
根据第七列的值判断1-11列改填充何种颜色,另外如何触发宏执行,我想当我输完第七列的值之后就执行一次
Sub fillcolor()
Dim RowStr As String
If ActiveCell.FormulaR1C1 = "H" Then
RowStr = "A" + Str(ActiveCell.Row)
Range(RowStr, "K11").Select
With Selection.Interior
.ColorIndex = 6
.Pattern = xlSolid
End With
End If
If ActiveCell.FormulaR1C1 = "M" Then
RowStr = "A" + Str(ActiveCell.Row)
Range(RowStr, "K11").Select
With Selection.Interior
.ColorIndex = 6
.Pattern = xlSolid
End With
End If
If ActiveCell.FormulaR1C1 = "S" Then
RowStr = "A" + Str(ActiveCell.Row)
Range(RowStr, "K11").Select
With Selection.Interior
.ColorIndex = 6
.Pattern = xlSolid
End With
End If
End Sub
根据第七列的值判断1-11列改填充何种颜色,另外如何触发宏执行,我想当我输完第七列的值之后就执行一次
Sub fillcolor()
Dim RowStr As String
If ActiveCell.FormulaR1C1 = "H" Then
RowStr = "A" + Str(ActiveCell.Row)
Range(RowStr, "K11").Select
With Selection.Interior
.ColorIndex = 6
.Pattern = xlSolid
End With
End If
If ActiveCell.FormulaR1C1 = "M" Then
RowStr = "A" + Str(ActiveCell.Row)
Range(RowStr, "K11").Select
With Selection.Interior
.ColorIndex = 6
.Pattern = xlSolid
End With
End If
If ActiveCell.FormulaR1C1 = "S" Then
RowStr = "A" + Str(ActiveCell.Row)
Range(RowStr, "K11").Select
With Selection.Interior
.ColorIndex = 6
.Pattern = xlSolid
End With
End If
End Sub
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货