Dates just the month?

apwdweb

Board Regular
Joined
Aug 23, 2002
Messages
86
Hi,

I have a column of dates that are in this format:

'01/2004

i'd like to capture just the month element into a variable for comparison purposes. does anyone know the VBA code to capture just the month element of this format?

Thanks
 

Excel Facts

Excel Joke
Why can't spreadsheets drive cars? They crash too often!
Hi

This should get you started. It does assume that the month is always 2 characters.

Tony

Sub bbb()
While Not IsEmpty(ActiveCell)

MsgBox Left(ActiveCell, 2)
ActiveCell.Offset(1, 0).Select
Wend
End Sub
 
Upvote 0
cool i'm not what i've got as far as text or date yet but suppose it is a date format. what would the code be then?

Thanks for your help. I do appreciate your time and efforts.
 
Upvote 0

Forum statistics

Threads
1,214,952
Messages
6,122,457
Members
449,083
Latest member
Ava19

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