|
我取消了这一步中的' Sheet1.Protect后,发现可以运行正常,只要在Sub moveP(nm As String, Optional F As Boolean)的开头加一句
Sheet1.UnProtect就可以了,学习了
谢谢你的分享。
Sub 错位()
'这一部分代码算法未优化,等有时间重写
Dim a As Shape, b As Shape, r As Range, nm As String, z As Integer
z = x * y - 1
For ii = 1 To Int(z * Rnd + z) + Int(z * Rnd + z)
'If ii Mod (x + y) <> 0 Then
' For i = 1 To z
' nm = i & "P"
' moveP nm, True
' Next
'Else
For i = z To 1 Step -1
nm = i & "P"
moveP nm, True
Next
' End If
Next
kRg = Empty
Sheet1.ScrollBar1.Enabled = False
Sheet1.ScrollBar2.Enabled = False
' Sheet1.Protect
End Sub
[ 本帖最后由 sailorgg 于 2009-11-24 11:19 编辑 ] |
|