
Problems with entering decimal values into excel 97 with Visual Basic
Hi,
If I want to put, for example, the decimal value of 2.1 into a cell in Excel
97 from a Visual Basic application, Ill get the result of 0 (=zero) in the
cell.
The code that I use is:
Dim objExcel As Object
Dim sSheetName As String
Dim nRow As Integer
Dim nCount As Integer
'vReport is an array containing decimal values that should be entered into
Excel 97
nRow=9
nCount=1
sSheetName = objExcel.ActiveSheet.Name
objExcel.Worksheets(sSheetName).Cells(nRow, 3) = CDec(vreport(2, nCount))
When I use this code to Excel 2000, there is no problem, the decimal values
are entered correctly.
Why doesnt Excel 97 allow decimal values into a cell from Visual Basic?
When I convert the
value to string it works, but then it is not possible to calculate with the
figures in the worksheet
because the figures are of the datatype string.
How should I make this work?
Regards,
Wenche