|
本帖最后由 kakaco 于 2011-10-31 12:41 编辑
亲。能解释解释吗?
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Application.EnableEvents = False
Dim i As Long
Dim x As Integer
Dim y As Integer
Dim z As Integer
Dim h As Integer
Dim l As Integer
If Target.Row = 1 And Target.Column = 1 Then
'MsgBox "老实呆着,不许跑。"
Else
Cells(Target.Row, Target.Column) = "悟空"
'MsgBox "如来:悟空,回来吧。"
x = Round((Rnd() * (3 - 1) + 1), 0)
'Cells(1, 1) = x
Cells(1, 1) = "如来神掌"
ActiveSheet.Shapes("Picture 2").Select
Selection.ShapeRange.IncrementLeft -5
Selection.ShapeRange.IncrementTop -5
'11111111111111111111111111111111111111111111111111111111111111111111
If x = 1 Then
For h = Target.Row To 1 Step -1
Cells(h + 1, Target.Column) = ""
If h <> 1 Then
Cells(h, Target.Column) = "悟空"
End If
For i = 1 To 4000000 Step 1
Next i
Next h
For l = Target.Column To 1 Step -1
Cells(1, l + 1) = ""
Cells(1, l) = "悟空"
For i = 1 To 4000000 Step 1
Next i
Next l
End If
'222222222222222222222222222222222222222222222222222222222222222222
If x = 2 Then
For l = Target.Column To 1 Step -1
Cells(Target.Row, l + 1) = ""
If l <> 1 Then
Cells(Target.Row, l) = "悟空"
End If
For i = 1 To 4000000 Step 1
Next i
Next l
For h = Target.Row To 1 Step -1
Cells(h + 1, 1) = ""
Cells(h, 1) = "悟空"
For i = 1 To 4000000 Step 1
Next i
Next h
End If
'3333333333333333333333333333333333333333333333333333333333333333333333
If x = 3 Then
h = Target.Row
l = Target.Column
If h > l Then
y = h
Else
y = l
End If
For z = y To 1 Step -1
h = h - 1
l = l - 1
Cells(h + 1, l + 1) = ""
If h < 1 Then
h = 1
End If
If l < 1 Then
l = 1
End If
Cells(h, l) = "悟空"
For i = 1 To 2000000 Step 1
Next i
Next z
End If
'----------------------------------------------------------------------
End If
Cells(1, 1).Select
Application.EnableEvents = True
End Sub
|
|