好的,我一直在网站上搜索,但找不到答案。我有一个2张工作簿。我有一个约14个单元格的合并单元格,其中所有其他单元格的SUM公式都在同一工作表上。我试图让WorkSheet_Change函数识别我的SUM'ed合并单元格中的值何时更改并修改不同工作表中的形状。我已使用SUM函数“AGILITY”命名合并的单元格,但如果我使用实际的单元格范围O35:U36则不起作用。任何帮助表示赞赏!
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "AGILITY" Then
If Target.Value = 0 Then
Worksheets("Character").Shapes("Oval 5").Fill.ForeColor.RGB = vbBlack
Worksheets("Character").Shapes("Oval 16").Fill.ForeColor.RGB = vbWhite
Worksheets("Character").Shapes("Oval 17").Fill.ForeColor.RGB = vbWhite
Worksheets("Character").Shapes("Oval 18").Fill.ForeColor.RGB = vbWhite
Worksheets("Character").Shapes("Oval 19").Fill.ForeColor.RGB = vbWhite
ElseIf Target.Value = 1 Then
Worksheets("Character").Shapes("Oval 5").Fill.ForeColor.RGB = vbWhite
Worksheets("Character").Shapes("Oval 16").Fill.ForeColor.RGB = vbBlack
Worksheets("Character").Shapes("Oval 17").Fill.ForeColor.RGB = vbWhite
Worksheets("Character").Shapes("Oval 18").Fill.ForeColor.RGB = vbWhite
Worksheets("Character").Shapes("Oval 19").Fill.ForeColor.RGB = vbWhite
ElseIf Target.Value = 2 Then
Worksheets("Character").Shapes("Oval 5").Fill.ForeColor.RGB = vbWhite
Worksheets("Character").Shapes("Oval 16").Fill.ForeColor.RGB = vbWhite
Worksheets("Character").Shapes("Oval 17").Fill.ForeColor.RGB = vbBlack
Worksheets("Character").Shapes("Oval 18").Fill.ForeColor.RGB = vbWhite
Worksheets("Character").Shapes("Oval 19").Fill.ForeColor.RGB = vbWhite
ElseIf Target.Value = 3 Then
Worksheets("Character").Shapes("Oval 5").Fill.ForeColor.RGB = vbWhite
Worksheets("Character").Shapes("Oval 16").Fill.ForeColor.RGB = vbWhite
Worksheets("Character").Shapes("Oval 17").Fill.ForeColor.RGB = vbWhite
Worksheets("Character").Shapes("Oval 18").Fill.ForeColor.RGB = vbBlack
Worksheets("Character").Shapes("Oval 19").Fill.ForeColor.RGB = vbWhite
ElseIf Target.Value = 4 Then
Worksheets("Character").Shapes("Oval 5").Fill.ForeColor.RGB = vbWhite
Worksheets("Character").Shapes("Oval 16").Fill.ForeColor.RGB = vbWhite
Worksheets("Character").Shapes("Oval 17").Fill.ForeColor.RGB = vbWhite
Worksheets("Character").Shapes("Oval 18").Fill.ForeColor.RGB = vbWhite
Worksheets("Character").Shapes("Oval 19").Fill.ForeColor.RGB = vbBlack
Else
Worksheets("Character").Shapes("Oval 5").Fill.ForeColor.RGB = vbWhite
Worksheets("Character").Shapes("Oval 16").Fill.ForeColor.RGB = vbWhite
Worksheets("Character").Shapes("Oval 17").Fill.ForeColor.RGB = vbWhite
Worksheets("Character").Shapes("Oval 18").Fill.ForeColor.RGB = vbWhite
Worksheets("Character").Shapes("Oval 19").Fill.ForeColor.RGB = vbWhite
End If
End If End Sub