Excel 如何向列添加时间戳和用户名?

Excel 如何向列添加时间戳和用户名?,excel,vba,Excel,Vba,我在Excel中有一个模块,它以特定的颜色突出显示行 Sub-RECEIVED() Application.ScreenUpdating=False '清除所有单元格的颜色 'ActiveSheet.Cells.Interior.ColorIndex=0 使用ActiveCell '高亮显示包含活动单元格的整行和整列 .EntireRow.Interior.ColorIndex=50 '.entireclumn.Interior.ColorIndex=41 以 Application.Scree

我在Excel中有一个模块,它以特定的颜色突出显示行

Sub-RECEIVED()
Application.ScreenUpdating=False
'清除所有单元格的颜色
'ActiveSheet.Cells.Interior.ColorIndex=0
使用ActiveCell
'高亮显示包含活动单元格的整行和整列
.EntireRow.Interior.ColorIndex=50
'.entireclumn.Interior.ColorIndex=41
以
Application.ScreenUpdating=True
端接头
我想添加日期和时间戳以及用户名。


日期和时间戳不需要采用该格式。我对任何有效的都很满意。

试试这个。我没有测试它,但应该可以工作

Sub RECEIVED()
    Application.ScreenUpdating = False

    ' Clear the color of all the cells
    ' ActiveSheet.Cells.Interior.ColorIndex = 0

    With ActiveCell
        ' Highlight the entire row and column that contain the active cell
        .EntireRow.Interior.ColorIndex = 50
        '.EntireColumn.Interior.ColorIndex = 41
    End With 
    dim str_Text as string : str_Text = application.username & " " & now
    activesheet.range("J" & selection.row) =str_Text     ' ad info in column J
    Application.ScreenUpdating = True
End Sub

作品非常感谢您抽出时间!