【发布时间】:2018-10-02 08:26:42
【问题描述】:
With Worksheets("Tripdata")
For filtercount = 1 To 1
Worksheets("Tripdata").Range("A1").AutoFilter Field:=4, Criteria1:=stationidentify(filtercount, 1)
For Each rowIndex In .UsedRange.Rows
If (rowIndex.Hidden) Then
'nothing
Else
If (firstpass) Then
firstpass = False
Else
MsgBox rowIndex(2, 2)
test = test + 1
Dim currentstat As Double, finalstat As Double
currentstat = Worksheets("Tripdata").Cells(rowIndex, 3).Value
finalstat = Worksheets("Tripdata").Cells(rowIndex, 7).Value
The tripdata visual look - I wanna somehow get the names on the fourth and seventh cells
您好,我正在尝试使用上述循环获取特定单元格。我认为 rowIndex 是 .Cells(row,column); 上的行号但似乎不是。我正在尝试使用过滤器遍历数据。
谁能帮我解决这个问题?
提前致谢。
【问题讨论】:
-
我不明白
MsgBox rowIndex(2, 2)。为什么要从当前 rowIndex 向下一排和 B 列中的单元格? -
@Jeeped 我目前正在尝试通过编写一堆东西来了解 rowIndex 实际得到的是什么。那是错误的。我的问题是不知道如何使用每个循环访问该行上的单元格。
-
For filtercount = 1 To 1?此外,(firstpass)应该只是filterpass
标签: vba excel loops excel-2007