单位不容许电脑装游戏,牛人教你EXCEL中玩扫雷游戏,

单位不容许电脑安装游戏,但是不能不让装OFFICE吧,想了想,用VBA编程编一段代码,玩玩小游戏,打发一下快下班的时间吧!

最后实现了,代码仅需 50行,可移植。

快来演示一下吧:

电脑上扫雷游戏记录怎么删除(单位不许装游戏)(1)

看看代码:

电脑上扫雷游戏记录怎么删除(单位不许装游戏)(2)

代码:

Private Sub Worksheet_SelectionChange(ByVal Target As Range)

Dim i, j, n, m As Integer

Dim vd, Hd As Integer

Dim sum As Integer

Dim arr(1 To 5, 1 To 5)

Dim bc, br As Integer

‘》》》》》》》》

bc = ActiveCell.Column

br = ActiveCell.Row

If bc < 6 And br < 6 Then

If Cells(br, bc) <> "*" Then

ActiveCell.Interior.Color = 255

sum = sum 1

Cells(br 20, bc) = 1

If Cells(26, 6) > 18 Then

For i = 1 To 5

For j = 1 To 5

Cells(i, j).Interior.Color = 255

Next

Next

MsgBox "恭喜你!你赢了!"

End If

Else

For i = 1 To 5

For j = 1 To 5

Cells(i, j).Interior.Color = 255

Next

Next

MsgBox "你输了!"

End If

End If

End Sub

有需要的关注我----私信

,