Fill Dates

helpexcel

Well-known Member
Joined
Oct 21, 2009
Messages
656
Is there an easier way to fill column B with the month of the date in column A.
This is what i am currently doing:
Sheet1.Range("B3:B" & Lastrow).Formula = "=Text(A3,""MMMM"")"
 

Excel Facts

Which Excel functions can ignore hidden rows?
The SUBTOTAL and AGGREGATE functions ignore hidden rows. AGGREGATE can also exclude error cells and more.
What's difficult with the code you've posted?
 
Upvote 0
Not if you want to keep the formula
 
Upvote 0
If no formulas makes the code run faster, and accomplishes the same thing, then goodbye formulas.
 
Upvote 0
Don't know if this will be quicker, it depends on the amount of data, but try
Code:
With Sheet1.Range("B2:B" & lastrow)
   .Value = Evaluate(Replace("if(@<>"""",text(@,""MMMM""),"""")", "@", .Offset(, -1).Address))
End With
 
Upvote 0
THANKS! I think it is faster.

I'll be playing with this piece,text(@,""MMMM""), to see if I can use it for WeekNum, and Year().
 
Upvote 0
If you get into problems trying to adapt it, then just start a new thread.
 
Upvote 0
If you would like it to happen automatically as you enter dates in column A
Try this:

This is an auto sheet event script
Your Workbook must be Macro enabled
To install this code:
Right-click on the sheet tab
Select View Code from the pop-up context menu
Paste the code in the VBA edit window

Code:
Private Sub Worksheet_Change(ByVal Target As Range)
'Modified  9/10/2018  3:02:38 PM  EDT
If Not Intersect(Target, Range("A:A")) Is Nothing Then
If Target.Cells.CountLarge > 1 Or IsEmpty(Target) Then Exit Sub
Target.Offset(, 1).Value = Format(Target.Value, "MMMM")
End If
End Sub
 
Upvote 0

Forum statistics

Threads
1,223,229
Messages
6,170,881
Members
452,364
Latest member
springate

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