WR = Range("A1").End(xlDown).Row + 1
If (WR = 3) Or _
((Second(Range("A2")) Mod 5) = 1) Then '總量有異動時才記錄..........................這個地方有寫錯嗎??還是要怎麼改比較好??
Cells(WR, 1).Resize(, 4) = [A2:D2].Value
End If
End Sub
1.我程式裡面沒有WorkSheet_Change(),
但有Private Sub Worksheet_Calculate()
Application.EnableEvents = False.............所以是加在這邊
Call RecordPrice
Application.EnableEvents = True..............還有這邊嗎??
End Sub
2.S大還沒說之前我是加在
Sub RecordPrice()
Dim WR As Long
Dim I As Byte
If Range("E2") < 1 Then Exit Sub
WR = Range("A1").End(xlDown).Row + 1
If (WR = 3) Or _
((Second(Range("A2")) Mod 5) = 1) Then
Application.EnableEvents = False.................這邊
Cells(WR, 1).Resize(, 4) = [A2:D2].Value
Application.EnableEvents = True...................還有這邊
End If
End Sub
C大我也有請教他,另外
Private Sub Worksheet_Calculate()
Application.EnableEvents = False.............所以是加在這邊
Call RecordPrice
Application.EnableEvents = True..............還有這邊嗎??
End Sub
..............................................................................................................................................................................
Sub RecordPrice()
Dim WR As Long
Dim I As Byte
If Range("E2") < 1 Then Exit Sub
WR = Range("A1").End(xlDown).Row + 1
If (WR = 3) Or _
((Second(Range("A2")) Mod 5) = 1) Then
Application.EnableEvents = False.................這邊
Cells(WR, 1).Resize(, 4) = [A2:D2].Value
Application.EnableEvents = True...................還有這邊
End If
End Sub
Private Sub Worksheet_Calculate()
Application.EnableEvents = False
Call RecordPrice
Application.EnableEvents = True
End Sub
有人進教室時
全體起立
敬禮
全體坐下
================================
Private Sub Worksheet_Calculate()
If 條件判斷 = True Then
Application.EnableEvents = False
Call RecordPrice
Application.EnableEvents = True
End If
有人進教室時
如果進來的是老師
全體起立
敬禮
全體坐下
End Sub