|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
之前做了一个表格,为了方便数据录入,也运行一两个月,没太大问题,但突然间最近老是出问题,(就是正常录入时突然间单元格格式变乱)求救各位老师,看如何优化代码Private Sub Worksheet_Change(ByVal Target As Range)If Not Intersect(Target, [B4:B500]) Is Nothing Then
Application.EnableEvents = False
Dim i%
i = Target.Row
Cells(2, 4).Copy Destination:=Cells(i, 4)
Cells(i, 4) = Cells(i, 4).Value
Cells(i, 4).Offset(0, 2).Select
Cells(i, 11) = Format(Now(), "yyyy-mm-dd")
Application.EnableEvents = True
End If
End Sub
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim i%
i = Target.Row
With Target
.Parent.Cells.Interior.ColorIndex = xlNone
End With
Range(Cells(i, "A"), Cells(i, "Aj")).Interior.ColorIndex = 34
End Sub
|
-
格式变乱感觉随机的,试了好几次,没有规律
-
-
Book1.zip
33 KB, 下载次数: 4
|