Max Segal
Max Segal

Reputation: 2045

Force English MonthName in VBA

My system configurations are set to Hebrew.

I want this function to return an English string:

MonthName(month(ActiveSheet.Range("i9").Value)))

but it returns Hebrew month name.

I tried to apply what works for me in excel formatting menu but it doesn't seem to work in Vba. What I tried is to add another argument:

MonthName(month(ActiveSheet.Range("i9").Value)),"b1mmmm")

with no luck...

I will appreciate any help.

Upvotes: 4

Views: 7738

Answers (1)

Bathsheba
Bathsheba

Reputation: 234635

I'd avoid fighting the locale settings if I were you as whatever you do probably will not end up being portable.

One way, and quite nice insofar that it's a spreadsheet-based solution, is to use

=CHOOSE(,"January","February", "March", "April", ..., "December")

Where the first argument points to a number between 1 and 12.

In VBA you could always set up an array and index that.

Upvotes: 10

Related Questions