- 帖子
- 764
- 主題
- 254
- 精華
- 0
- 積分
- 1031
- 點名
- 0
- 作業系統
- windows 11
- 軟體版本
- OFFICE2021
- 閱讀權限
- 50
- 性別
- 男
- 註冊時間
- 2011-5-30
- 最後登錄
- 2025-5-4
|
6#
發表於 2013-8-21 12:29
| 只看該作者
回復 t8899
看不懂你再問什麼
stillfish00 發表於 2013-8-21 11:35 
型態不符合????????????
Private Declare Function MsgBoxTest Lib "user32" Alias "MessageBoxTimeoutA" ( _
ByVal hwnd As Long, _
ByVal lpText As String, _
ByVal lpCaption As String, _
ByVal wType As VbMsgBoxStyle, _
ByVal wlange As Long, _
ByVal dwTimeout As Long) As Long
Private Sub Worksheet_Calculate()
Application.DisplayStatusBar = False
Dim sStr$
Dim ZZ As Range
sStr = ""
sStr2 = ""
For Each ZZ In Range("c2:c111")
If Not IsError(ZZ) Then
If Range("R26").Value = 2 Then Range("U26").Value = 1
If Range("Q26").Value = 1 And Range("U26").Value = 1 And flag = True Then
M = Round(ZZ - ZZ.Offset(, 26), 2)
If M >= ZZ.Offset(, 2) Then
If sStr <> "" Then sStr = sStr & Chr(10)
sStr = sStr & "===> " & Cells(ZZ.Row, 2).Value & "=====> " & Round(ZZ - ZZ.Offset(, 26), 2) & "===>" & ZZ.Offset(, 26) & "===>" & ZZ
Application.EnableEvents = False
ZZ.Offset(, 26) = ZZ
Application.EnableEvents = True
End If
If M <= -ZZ.Offset(, 2) Then
If sStr2 <> "" Then sStr2 = sStr2 & Chr(10)
sStr2 = sStr2 & "===> " & Cells(ZZ.Row, 2).Value & "=====> " & Round(ZZ - ZZ.Offset(, 26), 2) & "===>" & ZZ.Offset(, 26) & "===>" & ZZ
Application.EnableEvents = False
ZZ.Offset(, 26) = ZZ
Application.EnableEvents = True
End If
End If
End If
Next
If sStr <> "" Then
MsgBoxTest 0, "", "", sStr, 0, 2500
'----------------
If sStr2 = "" Then
If Range("R26").Value = 1 Then Range("U26").Value = 2
' Range("Q26").Value = 2
' Application.OnTime Now + TimeValue("00:00:15"), "fff"
End If
'----------------------------------------
End If
If sStr2 <> "" Then
MsgBoxTest 0, "", "", sStr2, 0, 2500
If Range("R26").Value = 1 Then Range("U26").Value = 2
End If
end sub |
|