Change footer date format for Spanish date

wd6849

New Member
Joined
Jan 1, 2023
Messages
2
Office Version
  1. 2021
Platform
  1. Windows
I need to change the format of the date in my footer to display it in Spanish with an alphabetic month, such as 01-ene-2023.

I found a process to modify the format for a date in my footer using a VBA module at


Here's the script:

Sub add_date_footer()
ActiveSheet.PageSetup.LeftFooter = Format(Date, "dd mmm yyyy")
End Sub



This will return the date for 01/01/2023 as 01 Jan 2023

However, I need to display the month abbreviation in Spanish (without changing my computer to Spanish).
In this case it should be 01 ene 2023.

Is there a way to do a VLOOKUP or something similar in the Format() for a page footer ?

Thanks for your help.
 

Excel Facts

How to calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a $25,000 loan, 5% annual interest, 60 month loan.
There's probably a more elegant solution than this, but it seems to work:
VBA Code:
Option Explicit
Sub add_date_footer()
    Dim i As Long, EspM  As String
    i = Month(Date)
    
    Select Case i
        Case Is = 1: EspM = "ene"
        Case Is = 2: EspM = "Feb"
        Case Is = 3: EspM = "mar"
        Case Is = 4: EspM = "abr"
        Case Is = 5: EspM = "may"
        Case Is = 6: EspM = "jun"
        Case Is = 7: EspM = "jul"
        Case Is = 8: EspM = "ago"
        Case Is = 9: EspM = "sep"
        Case Is = 10: EspM = "oct"
        Case Is = 11: EspM = "nov"
        Case Is = 12: EspM = "dic"
    End Select
    
    ActiveSheet.PageSetup.LeftFooter = Format(Date, "dd ") & EspM & Format(Date, " yyyy")
End Sub
 
Upvote 0
Solution

Forum statistics

Threads
1,223,907
Messages
6,175,300
Members
452,633
Latest member
DougMo

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