早上好,遍历列,
我试图找到一种方式来存储值的数组:通过一列
- 回路(B柱)
- 取值,商店他们在一个数组
- 遍历数组,并做一些文字处理
但是,我不能想办法来循环THROU gh列并将这些值存储在一个数组中。我已经通过堆栈溢出和谷歌,但还没有找到一个成功的解决方案(还)。
提前,谢谢你的帮助。
Sub collectNums()
Dim eNumStorage() As String ' initial storage array to take values
Dim i as Integer
Dim j as Integer
Dim lrow As Integer
lrow = Cells(Rows.Count, "B").End(xlUp).Row ' The amount of stuff in the column
For i = lrow To 2 Step -1
If (Not IsEmpty(Cells(i, 2).Value)) Then ' checks to make sure the value isn't empty
i = eNumStorage ' I know this isn't right
Next i
If (IsEmpty(eNumStorage)) Then
MsgBox ("You did not enter an employee number for which to query our database. Quitting")
Exit Sub
End If
End Sub
什么特别是你挣扎着 - 有很多网上关于从一个范围内创建一个数组? – SJR
我已经尝试了几种不同的方法,但使用输入的10个员工数字的测试数据样本,我还没有找到一种方法将它存储到数组中。 @SJR – bm0r3son