I am trying to write a code which automatically inserts the users username in a cell once a macro button is pressed.
Code
Sub Approve()
If ThisWorkbook.HasRoutingSlip = True Then
With ThisWorkbook.RoutingSlip
.Delivery = xlOneAfterAnother
Sheets("infosheet").Select
.Subject = "Here is " & ThisWorkbook.Name
.Message = "Here is the workbook. What do you think?"
End With
Workbooks("myfile.xls").Route
End If
Calculate
Sheets("infosheet").Select
If (Range("signoff1,signoff2,signoff3,signoff4,signoff5,signoff6")) Then
Range("signoff1").Value = Application.UserName
If IsEmpty(Range("signoff2,signoff3,signoff4,signoff5,signoff6")) Then
Range("signoff2").Value = Application.UserName
If IsEmpty(Range("signoff3,signoff4,signoff5,signoff6")) Then
Range("signoff3").Value = Application.UserName
If IsEmpty(Range("signoff4,signoff5,signoff6")) Then
Range("signoff4").Value = Application.UserName
If IsEmpty(Range("signoff5,signoff6")) Then
Range("signoff5").Value = Application.UserName
If IsEmpty(Range("signoff6")) Then
Range("signoff6").Value = Application.UserName
If ActiveWorkbook.HasRoutingSlip And _
Not ActiveWorkbook.Routed Then
ActiveWorkbook.Route
End If
End Sub
Display More
any ideas?