Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/excel/27.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何创建excel VBA更改日志_Vba_Excel - Fatal编程技术网

如何创建excel VBA更改日志

如何创建excel VBA更改日志,vba,excel,Vba,Excel,我正在尝试为excel VBA编写更改日志。我希望它能够遍历,以便每个附加响应都作为附加行填充到工作簿中。请让我知道,如果你有任何洞察我的代码有什么问题 Dim streply As String Dim Today As Date Dim myrange As Range Dim inglastrow As Long CurrentDate = Date With Sheets("Sheet1") lastrow = .Ran

我正在尝试为excel VBA编写更改日志。我希望它能够遍历,以便每个附加响应都作为附加行填充到工作簿中。请让我知道,如果你有任何洞察我的代码有什么问题

    Dim streply As String
    Dim Today As Date
    Dim myrange As Range
    Dim inglastrow As Long

    CurrentDate = Date

    With Sheets("Sheet1")
        lastrow = .Range("A" & .Rows.Count).End(xlUp).Row
        nextrow = lastrow + 1
        MsgBox lastrow
        MsgBox nextrow
    End With

    MsgBox lastrow
    streply = InputBox(Prompt:="Please type description of changes", Title:="Change Log", Default:="Brief Desc.")

    If streply <> " " Then
        Range("A" & nextrow).Value = Application.UserName
        Range("B" & nextrow).Value = streply
        Range("C" & nextrow).Value = ActiveWorkbook.Name
        Range("D" & nextrow).Value = Date
    End If

    Set lastrow = Nothing
    Set nextrow = Nothing

End Sub
Dim streply作为字符串
今天黯淡如白昼
将myrange变暗为Range
最后一行的长度
CurrentDate=日期
附页(“第1页”)
lastrow=.Range(“A”&.Rows.Count).End(xlUp).Row
nextrow=lastrow+1
MsgBox lastrow
MsgBox nextrow
以
MsgBox lastrow
streply=InputBox(提示:=“请键入更改说明”,标题:=“更改日志”,默认值:=“简要说明”)
如果是“那么”
范围(“A”&nextrow).Value=Application.UserName
范围(“B”和nextrow)。值=streply
范围(“C”&nextrow).Value=ActiveWorkbook.Name
范围(“D”和nextrow)。值=日期
如果结束
Set lastrow=无
Set nextrow=无
端接头

编辑:我犯了愚蠢的错误,现已修复

而不是:

lastrow = .Range("A" & .Rows.Count).End(xlUp).Row
尝试:


不清楚您的代码有什么问题?抱歉,它没有遍历代码。由于某种原因,最后一行停留在5,下一行停留在6。我看不到任何应该迭代的代码部分。你能详细解释一下你期望的结果吗?代码应该做什么?我希望它工作的方式是1)用户看到输入屏幕输入信息2)VBA找到最后一行并添加一行3)最后一行填充新值4)下一行填充更改日志信息此代码如何调用?你没有显示你的潜艇的起始位置。这是“变更单”吗事件?事件?事件?那是返回excel中的行总数的事件?事件?那是返回的总行数的事件?事件?那是返回在excel中的行总数的事件?事件?事件?那是返回在excel中的总行数的事件?事件?事件?那是返回的总行数的事件?事件?事件?那是返回的总行数的事件?事件?事件?那是返回的事件?事件?事件?事件?事件?事件?事件?事件?事件?事件?那是返回返回的总行总数的行数的行数的行数在excel中的总行数的数据,在excel中的数据的事件?事件?事件?事件?事件?事件?事件?事件?事件?事件?事件?事件?事件?事件?事件?事件?事件?事件?事件?事件?事件?事件?事件?事件?事件?事件?事件?事件?事件?那是返回的事件?那是返回的事件?那那是返回的返回返回的总行总数的总行数的行数的行数的4.0奈奈奈奈奈奈奈奈奈奈奈奈奈奈奈奈奈奈奈奈奈奈奈奈奈奈奈奈奈奈奈奈奈奈奈奈奈奈奈奈奈奈奈奈奈奈奈奈奈奈奈奈奈奈奈奈奈奈奈奈奈奈奈奈奈奈奈奈奈奈奈奈奈奈奈奈奈奈奈奈奈奈奈奈奈奈奈奈奈奈奈奈奈奈奈奈奈奈奈奈奈奈奈奈奈奈奈奈奈奈奈奈奈奈奈奈奈奈奈奈奈奈奈奈奈奈奈奈奈奈奈奈奈奈奈奈奈奈奈奈奈奈奈奈奈奈奈奈奈奈奈奈奈奈奈奈奈奈奈奈奈奈奈奈奈奈奈奈奈奈奈奈奈奈奈奈奈奈奈奈奈奈奈奈奈奈奈奈奈奈奈奈奈奈奈奈奈奈奈奈奈奈奈奈奈奈奈奈奈奈奈奈奈奈奈奈奈奈奈奈奈奈奈奈奈奈奈奈奈奈奈奈奈奈奈奈奈奈我,s,y,o,u,r,c,h,a,n,g,E,l,o,g,I,s,t,h,t"我,n,c,o,r,r,e,c,t"???????????????事实上?。现在就试试吧!最后一行是15和16。它不会将新响应添加为新行。谢谢你的帮助
lastrow = .UsedRange.Rows.Count