Extract Date

rsutton1981

New Member
Joined
Mar 9, 2016
Messages
47
Office Version
  1. 365
Platform
  1. Windows
Hi,

I have date in dd/mm/yyyy in column AY. I need he data as month only. I tried creating some VBA to do this but it does not work. I can work with either AY being changed to just show the month or have the month shown in AZ. Please help

Code:
Dim rng As Range
Dim row As Range
Dim cell As Range
Set rng = Range("ay15:ay25")
For Each row In rng.Rows
  For Each cell In row.Cells
       Sheets("data input").Range("ay" & rng.row) = Format(Date, "mmm")
  Next cell
Next row
 

Excel Facts

Format cells as currency
Select range and press Ctrl+Shift+4 to format cells as currency. (Shift 4 is the $ sign).
Try this:
Code:
Sub MyDate()
'Modified  7/2/2019  5:55:21 AM  EDT
Dim r As Range
For Each r In Sheets("data input").Range("ay15:ay25")
    r.Value = Format(Date, "MMM")
Next
       End Sub
 
Upvote 0
Hi,

try

Code:
Sheets("data input").Range("ay15:ay25").NumberFormat = "mmm"



Dave
 
Last edited:
Upvote 0

Forum statistics

Threads
1,213,552
Messages
6,114,278
Members
448,560
Latest member
Torchwood72

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