Simple export to excel format question

I’m simply exporting a string that looks like “420349.0050” and I want Excel to treat it as such. But Excel keeps turning it into a number so it displays “420349.005” - dropping the last 0 and aligning it right like a number.

I add the following in my script but then I get warning message from Excel saying that the number in this cell is being stored as text.

			.Cells.NumberFormat = "@"

.Cells.Value = SKUDisp

Is there a better way of telling Excel to treat SKUDisp as text regardless of the fact that all characters are numbers???

Thanks.

Subject: Simple export to excel format question

How about: .Cells.LocalFormula = “'” & SKUDisp

Like just typing the apostrophe then a number in Excel which tells it to treat it as a string.

(I think this is the correct script - my client is tied up running and agent so I can’t check the code where I’ve done this before)

Emily

Subject: RE: Simple export to excel format question

Just goes to show I should never trust my memory! It should be FormulaLocal not LocalFormula as I put in my previous post.

Emily.

Subject: RE: Simple export to excel format question

YES! The “'” didn’t quite work but the concept is right on. I just added & “.” to the end SKUDisp and worked like a charm. Easy solution for an annoying problem. THANK YOU EMILY!

Subject: RE: Simple export to excel format question

My pleasure :slight_smile: Glad to have been able to help!