Converting date from cell to month as mmm VBA

saadn

New Member
Joined
Apr 1, 2017
Messages
11
Hi,

I've got dates in column A in dd/mm/yyyy format and I need to extract the month number in mmm format in column H vba. I've used the following code to get the date into column H but cannot get it in mmm format.

Dim y As Integer
On Error Resume Next
For y = 1 To 10


If Not Cells(y, 1) = "Date" And Cells(y, 8) = "" Then
Cells(y, 8).Select
ActiveCell.Value = Cells(y, 1)

The reason I need to do this is each month bank statement data will be pasted into a tab and based on the month selected on the control sheet, the transactions for that particular month will be split between payments and receipt and moved to tabs called "payments" and "receipts" respectively. I was going to use the above code to extract the month from the date and based on what month is selected in the control sheet, write coding to pick up a transaction, work out if it is a payment and receipt and then move it. If there is a better way I can do this, that would help.
 
Put =ISNUMBER(A3) in a blank cell (change A3 to another cell in the range if it isn't a cell with a date in it).
Does it return TRUE or FALSE?

It is false on both occasions. I edited my previous post before reading this.
 
Upvote 0

Excel Facts

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop
It has nothing to do with your short date it is because you have text in the cells not real dates.
Is your Windows regional date setting in dd/mm/yyyy format?
If it is select column A, click Data, Text to Columns, click Next twice, click Finish.
Does the formula change to TRUE?
 
Upvote 0
It has nothing to do with your short date it is because you have text in the cells not real dates.
Is your Windows regional date setting in dd/mm/yyyy format?
If it is select column A, click Data, Text to Columns, click Next twice, click Finish.
Does the formula change to TRUE?

Yes - is this something I can incorporate into a macro
 
Upvote 0
You can record yourself carrying out the actions to give yourself the code.
Now they are real dates does the code in post number 8 give the results you expect?
 
Upvote 0

Forum statistics

Threads
1,224,829
Messages
6,181,224
Members
453,025
Latest member
Hannah_Pham93

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