简体   繁体   中英

Rowcount overflow in vba

I am using below code and this is getting overflow ,

     Dim RowCount As Integer
     RowCount = 1
     For Each rw In sh.Rows
     If sh.Cells(rw.Row, 1).Value = "Engg" Then
      r = RowCount
      addition (r) 'function
      End If
      RowCount = RowCount + 1 ' here rowcount is getting overflow.

How can I take Each loop with only avialable rows in sheet

如果您想知道特定列的确切行数,请使用DataRowCount = wsSheet.Cells(Rows.Count, nBasedColumn).End(xlUp).Row LastDataRow = wsSheet.Cells.Find(What:="*", SearchOrder:=xlByRows, searchdirection:=xlPrevious, MatchCase:=False).Row为您提供最后填充的行,与哪一列无关

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM