PDA

View Full Version : Date format



justdriving
10-12-2011, 11:22 AM
In Column 2,

If cell contains a date, then
I wanted to change the date format to dd-mmm-yyyy
from second row to end of row
using for ... next loop.




' How can I do it in VBA?

justdriving
10-12-2011, 12:32 PM
I have tried this and it worked...

Please advice, if there is a better method.

:think:

Bob Phillips
10-12-2011, 02:58 PM
Sub test()
Dim endrowofcol2 As Long

With ThisWorkbook.Sheets(1)

endrowofcol2 = .Cells(Rows.Count, 2).End(xlUp).Row
With .Range("B1").Resize(endrowofcol2)

.NumberFormat = "dd-mmm-yyyy"
End With
End With
End Sub