1

I am working with Excel Macros,

I had come across command ActiveCell.End(xlDown).Select to go to the last row of the table

I am currently using this command to find the total no of rows

ActiveCell.End(xlDown).Select

y = ActiveCell.Row

but the problem is for large data the command skips the data, where is a change in data of the next row.

what maybe the possible problem?

(you can see the table 1069 & 1070 the data type is date which is in same format but the code skipped out uncertainly[note: when there is a change in second column] )

.
.
.
1068 >  20-08-2012    C0    138225    98.91608138    99.25925926
1069 >  20-08-2012    C0    138226    99.71159982    98.95776825
1070 >  21-08-2012    __    506821       65335U11     0     
1071 >  21-08-2012    C0    100381     0              0
.
.
.
Community
  • 1
  • 1

1 Answers1

0

I'm spinning off the comments but you should always use xlUp rather than xlDown so as to avoid problems with blanks.

Please select a cell in the target column and run the following:

Sub findTherow()
Dim y As Integer
With Excel.ActiveSheet
            y = .Cells(.Rows.Count, ActiveCell.Column).End(Excel.xlUp).Row
End With
MsgBox ("Look what I found:" & y)
End Sub
whytheq
  • 34,466
  • 65
  • 172
  • 267