1)在工作表sheet1的A1:F1中输入1~6这6个数字<br>2)在A3中输入9<br>3)在工作表界面作如下操作:<br>标题栏->工具->宏->vixual basic编辑器(单击打开)<br>在打开的vixual basic编辑器窗口作如下操作:<br>标题栏->视图->工程资源管理器(单击打开)<br>双击sheet1(注意你的工作表如果是sheet2,就双击sheet2)<br>右边出现一大片空白区域<br>将下述代码复制->粘贴进去<br>Private Sub Worksheet_SelectionChange(ByVal Target As Range)<br>Dim i As Integer<br>[iq1:iv1] = "=rand()"<br>100:<br>If Cells(1, 251) > 0.5 Then Cells(2, 1) = "" Else Cells(2, 1) = Cells(1, 1)<br>If Cells(1, 252) > 0.5 Then Cells(2, 2) = "" Else Cells(2, 2) = Cells(1, 2)<br>If Cells(1, 253) > 0.5 Then Cells(2, 3) = "" Else Cells(2, 3) = Cells(1, 3)<br>If Cells(1, 254) > 0.5 Then Cells(2, 4) = "" Else Cells(2, 4) = Cells(1, 4)<br>If Cells(1, 255) > 0.5 Then Cells(2, 5) = "" Else Cells(2, 5) = Cells(1, 5)<br>If Cells(1, 256) > 0.5 Then Cells(2, 6) = "" Else Cells(2, 6) = Cells(1, 6)<br>If [A2] + [b2] + [C2] + [D2] + [E2] + [F2] <> [A3] Then GoTo 100<br>End Sub<br>4)任意单击任何单元格,则在第二行中会为你自动显示等于9的和的数字