Error reading datarowcnt for each sheet

Posted by: yianeco on 7 March 2019, 12:32 am EST

  • Posted 7 March 2019, 12:32 am EST


    I am attaching a workbook with 9 sheets.
    I am starting from sheet 2 and up and try to get the value of data rows using datarowcnt.
    For sheet 2 I get the correct value 8.
    But for all others I always get the value 10! instead of zero.
    Please explain what is going on here!

  • Replied 7 March 2019, 8:48 pm EST

    Hi Yiannis,

    I loaded the spread file in to Spread COM v8.0(unicode) and found that it is giving incorrect data row count. I have submitted it to the development team for further investigation. I will let you know as soon I hear anything on this. The tracking id for this is #270565.

    Deepak Sharma
  • Replied 29 March 2019, 7:28 am EST


    Anything on the issue please ?

  • Replied 31 March 2019, 5:11 pm EST

    Hi Yiannis,

    We are still waiting for an update from the development team on this. I will inform you once I get an update on it.

    Deepak Sharma
  • Marked as Answer

    Replied 4 April 2019, 8:13 pm EST

    Hi Yiannis,

    I got the following response from the development team:
    t looks like some of the check box cells got checked and unchecked at some point in the designer, and so those cells have residual "0" values causing the DataRowCnt to show the unexpected value.

    Here is code I added in the button after setting ActiveSheet that finds the last cell with data, sets it active and shows the value it contains:

    Dim row As Long
    Dim col As Long
    Dim value
    For row = fpSpread1.DataRowCnt To 1 Step -1
    For col = 1 To fpSpread1.DataColCnt
    If fpSpread1.GetText(col, row, value) Then
    fpSpread1.row = row
    fpSpread1.col = col
    GoTo done
    End If
    Next col
    Next row

    fpSpread1.Action = ActionActiveCell

    MsgBox (Str$(fpSpread1.DataRowCnt) & " -- Last Cell with a value: (" & Str$(col) & "," & Str$(row) & ") = " & fpSpread1.Text)

    You can use that code to find the cells with the "0" values and then use the ClearRange method with data only flag to clear the values.

    Deepak Sharma
  • Replied 6 July 2019, 3:27 pm EST

    Thank you for the very valuable info!
    This is a very helpfull tip.


Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels