7,759
社区成员
发帖
与我相关
我的任务
分享
Function PullColArray() As String()
Dim iAllowMaxRowId As Long, objSheet As Worksheet
Dim i As Long, strText As String, strResult() As String
Set objSheet = Me
iAllowMaxRowId = objSheet.Rows.Count
ReDim strResult(iAllowMaxRowId)
Dim iRealMaxRowId As Long
iRealMaxRowId = 0
For i = 1 To iAllowMaxRowId
strText = objSheet.Cells(i, 1).Text
If (Len(strText) > 0) Then
strResult(i) = strText
iRealMaxRowId = i
End If
Next i
ReDim Preserve strResult(iRealMaxRowId)
PullColArray = strResult
MsgBox UBound(PullColArray)
End Function