是否存在可能导致宏有时无法使用的大小限制?输入数据后,我的容量为450KB至460KB。问题有时是时间和日期戳不起作用。我在7台不同的计算机上有相同的表格,并且它是随机发生的。不知道是用户错误还是代码错误,但想问我关于大小限制的问题。
Private Sub Worksheet_Change(ByVal Target As Range)
Dim CC As Range
Dim CB As Range
Application.EnableEvents = False
If Not Intersect(Range("C16:C101"), Target) Is Nothing Then
For Each CC In Intersect(Range("C16:C101"), Target)
If CC.Value <> "" Then
CC.Offset(, -2).Value = Date & " "
CC.Offset(, -2).NumberFormat = "mm/dd/yy"
End If
Next CC
End If
Application.EnableEvents = True
Application.EnableEvents = False
If Not Intersect(Range("C16:C101"), Target) Is Nothing Then
For Each CC In Intersect(Range("C16:C101"), Target)
If CC.Value <> "" Then
CC.Offset(, -1).Value = Time & " "
CC.Offset(, -1).NumberFormat = "hh:mm"
End If
Next CC
End If
Application.EnableEvents = True
Application.EnableEvents = False
If Not Intersect(Range("x16:x101"), Target) Is Nothing Then
For Each CC In Intersect(Range("x16:x101"), Target)
If CC.Value <> "" Then
CC.Offset(, 1).Value = Date & " " & Time
CC.Offset(, 1).NumberFormat = "mm/dd/yy hh:mm"
End If
Next CC
End If
Application.EnableEvents = True
Application.EnableEvents = False
If Not Intersect(Range("AC16:AC101"), Target) Is Nothing Then
For Each CB In Intersect(Range("AC16:AC101"), Target)
If CB.Value <> "" Then
CB.Offset(, -1).Value = Date & " "
CB.Offset(, -1).NumberFormat = "mm/dd/yy"
End If
Next CB
End If
Application.EnableEvents = True
Application.EnableEvents = False
If Not Intersect(Range("Ah16:Ah101"), Target) Is Nothing Then
For Each CB In Intersect(Range("Ah16:Ah101"), Target)
If CB.Value <> "" Then
CB.Offset(, -1).Value = Date & " " & Time
CB.Offset(, -1).NumberFormat = "mm/dd/yy hh:mm:ss"
End If
Next CB
End If
Application.EnableEvents = True
Application.EnableEvents = False
If Not Intersect(Range("Am16:Am101"), Target) Is Nothing Then
For Each CB In Intersect(Range("Am16:Am101"), Target)
If CB.Value <> "" Then
CB.Offset(, -1).Value = Date & " " & Time
CB.Offset(, -1).NumberFormat = "mm/dd/yy hh:mm:ss"
End If
Next CB
End If
Application.EnableEvents = True
End Sub