繁体   English   中英

vba中的行数溢出

[英]Rowcount overflow in vba

我正在使用下面的代码,这正在溢出,

     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.

我怎样才能在工作表中使用只有可用行的每个循环

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

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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