ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Copy Data (https://www.excelbanter.com/excel-programming/275217-copy-data.html)

PEdro

Copy Data
 
Hi

I have in cell A1 the value 31/09/2003
This is formatted has mmmm/yyyy
So the result is "September 2003"

What code should I write in order for getting the variable
strMon with the
first 3 caracters of September "Sep"

Thanks
Pedro



Don Guillett[_4_]

Copy Data
 
I don't quite understand but if you just want to format your date as Sep
mmm

"PEdro" wrote in message
...
Hi

I have in cell A1 the value 31/09/2003
This is formatted has mmmm/yyyy
So the result is "September 2003"

What code should I write in order for getting the variable
strMon with the
first 3 caracters of September "Sep"

Thanks
Pedro





John Wilson

Copy Data
 
PEdro,

First of all, there isn't a September 31st (at least on my calendar).
When you enter a date in a cell, it's stored numerically.
When you format it, all you're doing is telling Excel how you'd
like it displayed. It doesn't really change its numeric equivalent.
So if there's a date in A1 and you just want the three letter month,
the following should work:

Sub TestMe()
Dim rDate As String
rDate = Format(Range("A1").Value, "mmm")
MsgBox rDate
End Sub

John

PEdro wrote:

Hi

I have in cell A1 the value 31/09/2003
This is formatted has mmmm/yyyy
So the result is "September 2003"

What code should I write in order for getting the variable
strMon with the
first 3 caracters of September "Sep"

Thanks
Pedro




All times are GMT +1. The time now is 08:50 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com