excelVBA如何当某固定列的数据改变时在另一工作表中按先后顺序记录下来
展开全部
假设该固定列为worksheet1 A1:A10,在SHEET2记录。代码如下:
Private Sub Worksheet_Change(ByVal Target As Range)
If Not Application.Intersect(Worksheets(1).Range("A1:A10"), Target) Is Nothing Then
Dim my_Row As Single
With Worksheets(2)
my_Row = .Cells(10000, 1).End(xlUp).Row
.Cells(my_Row + 1, 1) = Now
.Cells(my_Row + 1, 2) = Target.Address
.Cells(my_Row + 1, 3) = Target.Value
.Cells(my_Row + 1, 4) = Target.Value2
End With
End If
End Sub
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询