Excel 2013 VBA Worksheet_Change合并单元格与公式
好的,我一直在网站上search,找不到答案。 我有一个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