datagrid输出到Excel出现问题
我datagrid中的内容为
2004-10-11 65253 361722 426975
2004-10-12 62922 357160 420082
2004-10-13 65571 359424 424995
2004-10-14 62163 352999 415162
2004-10-15 66221 356276 422497
2004-10-16 65630 364290 429920
2004-10-17 65625 363058 428683
2004-10-18 66722 323837 421405
2004-10-19 64999 346301 411696
2004-10-20 63276 368765 401987
2004-10-21 61553 391229 392278
2004-10-22 59830 413693 382569
2004-10-23 58107 436157 372860
2004-10-24 56384 458621 363151
2004-10-25 54661 481085 353442
2004-10-26 52938 503549 343733
2004-10-27 51215 526013 334024
2004-10-28 49492 548477 324315
2004-10-29 47769 570941 314606
2004-10-30 46046 593405 304897
2004-10-31 44323 615869 295188
2004-11-1 42600 638333 285479
输出到Excel显示如下,并提示行号出错
2004-10-11 65253 361722 426975
2004-10-12 62922 357160 420082
2004-10-13 65571 359424 424995
2004-10-14 62163 352999 415162
2004-10-15 66221 356276 422497
2004-10-16 65630 364290 429920
2004-10-17 65625 363058 428683
2004-10-18 66722 323837 421405
2004-10-23 64999 346301 411696
2004-11-1
如果有更多的记录,前8个记录正常,往后就开始跳越,每次跳过1+4天,1+4+4天,1+4+4+4天.....
各位高手帮我看看哪里问题
Private Sub Command2_Click()
Dim i As Integer
Dim j As Integer
Dim xlApp As Excel.Application
Dim xlBook As Excel.Workbook
Dim xlSheet As Excel.Worksheet
Set xlApp = CreateObject("Excel.Application")
xlApp.Visible = True
Set xlBook = xlApp.Workbooks.Add
Set xlSheet = xlBook.Worksheets(1)
For i = 0 To DataGrid1.ApproxCount - 1
For j = 0 To DataGrid1.Columns.Count - 1
DataGrid1.Row = i
DataGrid1.Col = j
If IsNull(DataGrid1.Text) = False Then
xlSheet.Cells(i + 1, j + 1) = DataGrid1.Text
End If
Next j
Next i
End Sub