下面的代碼應該給予必要的輸出你正在尋找:
子pInsert1000()
Dim lngLoop As Long
Dim lngTotal As Long
Dim lngCounter As Long
Dim rngRange As Range
Dim strConcatACol As String
Dim strConcatBCol As String
Set rngRange = Cells.Find("*", Cells(1, 1), xlFormulas, xlWhole, xlByRows, xlPrevious)
If Not rngRange Is Nothing Then
lngTotal = rngRange.Row
Else
lngTotal = 0
End If
lngCounter = 0
lngLoop = 1
While lngLoop < lngTotal
lngCounter = lngCounter + 1
If lngCounter = 1 Then
strConcatACol = Cells(lngLoop, 1)
strConcatBCol = Cells(lngLoop, 2)
Else
strConcatACol = strConcatACol & ", " & Cells(lngLoop, 1)
strConcatBCol = strConcatBCol & ", " & Cells(lngLoop, 2)
End If
If lngCounter = 1000 Then
Rows(lngLoop + 1).EntireRow.Insert
Cells(lngLoop + 1, 8) = strConcatACol
Cells(lngLoop + 1, 9) = strConcatBCol
lngLoop = lngLoop + 1
lngTotal = lngTotal + 1
lngCounter = 0
End If
lngLoop = lngLoop + 1
Wend
Set rngRange = Nothing
末次
你想要的*級聯*是一個公式或只是級聯值?你希望它在*列H *? – L42 2014-10-10 22:17:50