Hi, I'm new to VBA and trying to design a macro that populates a username in a neighboring column after a save. For example, a user populates a value in cell A1. When the worksheet is saved, the user's name appears in cell B1.

Here's what I tried...

Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
If Sheets("Sheet1").Range("A1:A50").Value <> "" Then
Sheets("Sheet1").Range("B1:B50").Value = Environ("username")
End If
End Sub

Thanks for your help.