Export data to excel spreadsheet by formatting the cell

Asked

Viewed 13 times

-1

I am exporting data to Excel, but the format of the created spreadsheet is not what is desired. I am exporting the text 000 however Excel understands as being number, and the exported value is 0. The code I’m using is as follows: txt_export="000" .range(a1). value=txt_export.

Another example is: txt_export="060" .range(a1). value=txt_export.

The exported value for Excel is 60.

Thanks for your attention.

1 answer

0

I found the solution. Just add the following line:

Range("A1"). Numberformat = "@"

Browser other questions tagged

You are not signed in. Login or sign up in order to post.