Range.Rows.Count无法正常工作

时间:2019-07-15 02:22:57

标签: excel vba

我想遍历一列中的所有值。我的专栏只有17个值。但它指出行号为1048756

Range("A1", Range("A1").End(xlDown)).Rows.Count-此方法返回错误的值

Windows("Sheet1.xlsx").Activate
Dim x As Integer
Dim y As Integer
Dim a As Integer
Dim b As Integer
a = 2
b = 1


NumRows = Range("A1", Range("A1").End(xlDown)).Rows.Count
Numcols = Range("A1", Range("A1").End(xlToRight)).Columns.Count
MsgBox NumRows



For x = 2 To NumRows
    b = 1
    For y = 1 To Numcols

NumRows显示1048756。在For x=2行,是说

  

运行时错误6。

0 个答案:

没有答案