Date format macro code

jaeremata

New Member
Joined
Jan 20, 2021
Messages
24
Office Version
  1. 2019
  2. 2016
Platform
  1. Windows
Hi Everyone, I need some help in my macro. Currently I have a code that will change the date format to yyyy-mm-dd, but what I want to also happen is to change it on Short date. Here's my attempt:
If you can see on the SS, the highlighted yellow is what is showing on the filter but what I want is on the blue circle. When I used .Value = DateValue its' not working. Is there anyway to change it like on the blue circle on?

1612275265069.png


Here's my attempt:
With Worksheets("NC")
With .Range("j3:k" & .Cells(.Rows.Count, "G").End(xlUp).Row) 'Fixed

.NumberFormat = "yyyy-mm-dd"
.Font.Size = 11
.Font.Name = "Calibri"
.Font.Color = vbBlack
.Font.Bold = False
 

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
How about:
VBA Code:
.NumberFormat = "yyyy-mmmm-dd"
 
Upvote 0
Your code is .NumberFormat = "yyyy-mm-dd"
Mine is .NumberFormat = "yyyy-mmmm-dd"

date dd-mmmm-yyyy.jpg
 
Upvote 0
Your code is .NumberFormat = "yyyy-mm-dd"
Mine is .NumberFormat = "yyyy-mmmm-dd"

View attachment 31100
When I do that, it will change the value on the column. What I want to see is the look will be the same on the excel like this, but the filter will give me the option like on your screen shot


1612346945865.png
 
Upvote 0
What I want to see is the look will be the same on the excel like this, but the filter will give me the option like on your screen shot
Sorry, I don't know how to do that.
Maybe other members have a better idea.
 
Upvote 0
You're welcome, glad you figured it out.
 
Upvote 0

Forum statistics

Threads
1,223,889
Messages
6,175,226
Members
452,620
Latest member
dsubash

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