Have two lines of text in the footer of Excel VBA

Livin404

Well-known Member
Joined
Jan 7, 2019
Messages
743
Office Version
  1. 365
  2. 2019
Platform
  1. Windows
Good evening,



I had help in earlier with a code and it works terrific. However I have a date and time code I also use for the footer. I'm hoping I can have both of these with the name right above the date and time.

The codes work brilliant on there own, I just need to either combine them or have another statement in the 2nd macro.

Thank you,

VBA Code:
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


I want this date and time to appear right below the name.


VBA Code:
Sub Date_Time()
          ActiveSheet.PageSetup.LeftFooter = "&12&""Times New Roman""" & Format(Now, "DD MMM YY hh:mm")
        End Sub
 

Excel Facts

Lock one reference in a formula
Need 1 part of a formula to always point to the same range? use $ signs: $V$2:$Z$99 will always point to V2:Z99, even after copying
Thank you for all that considered helping.
I have it sorted. I asked for I wasn't sure how long I would be struggling with it. I have it now.
 
Upvote 0

Forum statistics

Threads
1,215,096
Messages
6,123,074
Members
449,094
Latest member
mystic19

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