Post user name in footer of Excel Worksheet

Livin404

Well-known Member
Joined
Jan 7, 2019
Messages
743
Office Version
  1. 365
  2. 2019
Platform
  1. Windows
Hello I have the following Micro and it works find for placing a truncated user name a little after the last entry in Column A. What I am hoping to do is have the truncated user name be placed in the left footer.
This is the micro that I currently have and it works, because it's been done hundreds of times. My new project requires it to be placed in the footer. I hope someone may be able to help me out. I'm know the range line we need to be adjusted.

VBA Code:
Sub USER_NAME()
Dim LastRow As Long
Dim wName As String, wSurame As String, Title As String
Dim x As Variant
LastRow = ActiveSheet.Cells(Rows.Count, "A").End(xlUp).Row
wName = Replace(Application.UserName, "Esq", "MR")
wSurname = UCase(Split(wName, ",")(0))
For Each x In Array("MR ", "MS")
If InStr(wName, x) > 0 Then
Title = UCase(x)
Exit For
End If
Next x
Range("A" & LastRow + 3).Value = "SUBMITTED BY: " & Title & wSurname
End Sub
 

Excel Facts

Excel Can Read to You
Customize Quick Access Toolbar. From All Commands, add Speak Cells or Speak Cells on Enter to QAT. Select cells. Press Speak Cells.
Re: "and it works". Not if you have "Option Explicit" in your module(s)
"wSurame As String" is missing an "n"

Change
Code:
Range("A" & LastRow + 3).Value = "SUBMITTED BY: " & Title & wSurname
to
Code:
ActiveSheet.PageSetup.LeftFooter = Title & wSurname
 
Upvote 1
Solution
Thank you, I ended up with and it worked fine, I rushed back here to let it be known it was sorted.

Thank you,


Sub user()
Dim wName As String, wSurname As String, Title As String
Dim x As Variant
wName = Replace(Application.UserName, "Esq", "MR")
wSurname = UCase(Split(wName, ",")(0))
For Each x In Array("MR ", "MS")
If InStr(wName, x) > 0 Then
Title = UCase(x)
Exit For
End If
Next x
With ActiveSheet.PageSetup
. LeftFooter = "SUBMITTED BY: " & Title & wSurname
End With
End Sub
 
Upvote 0

Forum statistics

Threads
1,215,123
Messages
6,123,183
Members
449,090
Latest member
bes000

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top