Hi,
I am writing macro to copy an excel sheet to another excel sheet with some modification of the data. But I have some currency and numeric field in the source excel sheets, which I need to copy as it is in the target excel sheet.
But when I copy them, the trailing zero is truncated.

Suppose, I have 420.70 in the source file, it is copied as 420.7, even though I set the type of the target column as String.

The code I used as follows -

temp = wsSource.Cells(i, j).Value
wsTarget.Cells(n, k).Value = temp

i,j,n,k are index variables.
Any suggestion is appreciated.

I think your problem is because you are declaring the number as string and not Integer. Try to change it to Currency, Integer, Number.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.