早上好,遍歷列,
我試圖找到一種方式來存儲值的數組:通過一列
- 迴路(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