ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   NumberFormat not taking (https://www.excelbanter.com/excel-programming/298953-numberformat-not-taking.html)

Simon Woods[_3_]

NumberFormat not taking
 
Hi

I'm loading data into a sheet. I'm setting the NumberFormat of the column

' ---- set default date format i.e. "dd-mm-yyyy"
l_oSheet.Columns(l_nCol).NumberFormat = C_DEFAULT_DATEFORMAT

' ---- if a custom format for the data is set, use that i.e. "mm/yy"
If LenB(.Format(l_nCol)) < 0 Then
l_oSheet.Columns(l_nCol).NumberFormat = .Format(l_nCol)
End If

When I load the data, the data is being displayed in "dd/mm/yyyy" format
irrespective of the format I'm setting the column to. I've also tried
setting the NumberFormat of each cell and this makes no difference

What more do I need to do to get Excel to recognise my custom format. Or do
I need to use a completely different mechanism?

Thanks

Simon




All times are GMT +1. The time now is 04:17 PM.

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