Problems with entering decimal values into excel 97 with Visual Basic 
Author Message
 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



Sat, 06 Mar 2004 21:17:35 GMT  
 Problems with entering decimal values into excel 97 with Visual Basic
Try using cDbl rather than cDec ?


Sat, 06 Mar 2004 22:28:26 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. WANTED: Excel-Visual Basic for Applications Wanted: Excel-Visual Basic for applications Programmer - Ottawa

2. DAO & Excel 97/Visual Basic problem

3. Problems Using Page Breaks in Excel 97 from Visual Basic

4. Problems Adding Page Breaks in Excel 97 using Visual Basic

5. Excel 97 Visual basic problem

6. Problems Using Page Breaks in Excel 97 from Visual Basic

7. Problems Adding Page Breaks in Excel 97 using Visual Basic

8. Converting and Excel Visual Basic File to an Access Visual Basic

9. Visual basic in Excel 97 part of Office 97

10. Entering Unicode in excel cells using Visual Basic


 
Powered by phpBB® Forum Software © phpBB Group