Format Cell as Currency - pound sterling £

Apr 9, 2013 at 7:20 PM

I'm trying to set a currency format like this
ws.Cells("A1".Style.Numberformat.Format = """£""\ #,##0.00"
or just
ws.Cells("A1".Style.Numberformat.Format = "£#,##0.00"

but in excel i see £ instead of £. digging around it seems like a conflicting encoding, something is converting between utf8 and codepage 1252 or the other way around maybe.

Can anyone help?

Apr 9, 2013 at 7:38 PM

It was because of the encoding of my source file. I think i just asked windows to create a new text file and started using that. I think my editor treated it as utf8 but didn't add a BOM so maybe technically it was corrupt, and then .net assumed it wasn't utf8 so treated it as ascii and i got extra chars. so frustrating, i've been on this for hours! :)

So literally 2 minutes after posting that, i found the answer myself. Anyone know if there is a name for that?. If not, I officially name it Mulvihill's Law.