excel表格如何自动进级vba
Cells(Target.Row, 1) = Now()
的错误在于“ ,”
vba只识别英文状态的“ , ”
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Row >= 3 And Target.Row <= 100 And _
Target.Column >= 2 And Target.Column <= 10 Then
Application.EnableEvents = False
Cells(Target.Row, 1) = Now()
Application.EnableEvents = True
End If
End Sub
把上面的语句贴上去看看。
这段代码的意思是
在你所激活的单位格在 3行到100行, 2列到10列之间时
所选取当前单位格的第一列 = 当前时间 now()
但愿能帮到你。
2.excel 自动更新记录VBA在工程资源打点器中双击“操纵表”单位格,然后粘贴下列代码进去
Dim DumpData(1 To 10, 1 To 6) As Integer
Private Sub Worksheet_Change(ByVal Target As Range)
Dim LogSht As Worksheet, iRow As Integer, iColumn As Integer, TrgColmn As Integer, j As Integer
TrgColmn = Target.Column
If TrgColmn < 9 Or TrgColmn > 14 Then Exit Sub
Set LogSht = Worksheets("日志")
iColumn = 4 * (TrgColmn - 9) + 1
Dim i As Integer
i = 3
Do
If LogSht.Cells(i, iColumn) = "" Then Exit Do
i = i + 1
Loop Until False
LogSht.Cells(i, iColumn) = Now
LogSht.Cells(i, iColumn + 1) = DumpData(Target.Row - 4, TrgColmn - 8)
LogSht.Cells(i, iColumn + 2) = Target.Text
LogSht.Cells(i, iColumn + 3) = Target.Address
For i = 1 To 10
For j = 1 To 6
DumpData(i, j) = Cells(i + 4, j + 1)
Next
Next
End Sub第一次变换修改前会呈现数据缺失,需人工过问调解
3.excel 自动更新记录VBA在工程资源打点器中双击“操纵表”单位格,抖客教程网,然后粘贴下列代码进去 Dim DumpData(1 To 10, 1 To 6) As IntegerPrivate Sub Worksheet_Change(ByVal Target As Range) Dim LogSht As Worksheet, iRow As Integer, iColumn As Integer, TrgColmn As Integer, j As Integer TrgColmn = Target.Column If TrgColmn < 9 Or TrgColmn > 14 Then Exit Sub Set LogSht = Worksheets("日志") iColumn = 4 * (TrgColmn - 9) + 1 Dim i As Integer i = 3 Do If LogSht.Cells(i, iColumn) = "" Then Exit Do i = i + 1 Loop Until False LogSht.Cells(i, iColumn) = Now LogSht.Cells(i, iColumn + 1) = DumpData(Target.Row - 4, TrgColmn - 8) LogSht.Cells(i, iColumn + 2) = Target.Text LogSht.Cells(i, iColumn + 3) = Target.Address For i = 1 To 10 For j = 1 To 6 DumpData(i, j) = Cells(i + 4, j + 1) Next NextEnd Sub第一次变换修改前会呈现数据缺失,需人工过问调解。
4.怎么用VBA让excel中的时间跟着录入操纵的行动而自动更新时间Private Sub Worksheet_Change(ByVal Target As Range) If Target.Row >= 3 And Target.Row = 2 And Target.Column