如何在VBA中的数组之间输入空行?在下面的代码中,我将整个数据复制到数组中,然后检查D列中的任何两个值是否不同。如果是,则输入空白行。我正在使用的代码:
sub enternewline()
Dim Start, Finish, TotalTime
Dim WorksheetToRead As String
Dim DataRange As String
Dim SheetArray As Variant
'Start = Timer
WorksheetToRead = "sht_mccr"
StartCol = "D"
EndCol = "F"
StartRow = 4
lastrow = 80000 'Sheets(WorksheetToRead).Cells(Rows.Count, "A").End(xlUp).Row
DataRange = StartCol & Trim(Str(StartRow)) & ":" & EndCol & Trim(Str(StartRow - 1 + lastrow))
SheetArray = sht_mccr.Range(DataRange).Value
For ArrayLoopCounter = LBound(SheetArray, 1) To UBound(SheetArray, 1)
If SheetArray(ArrayLoopCounter, 1) <> SheetArray(ArrayLoopCounter + 1, 1) Or _
SheetArray(ArrayLoopCounter, 2) <> SheetArray(ArrayLoopCounter + 1, 2) Then
SheetArray(ArrayLoopCounter, 1) = ""
SheetArray(ArrayLoopCounter + 1, 1).EntireRow.Insert shift:=xlDown //Wanted help here in this line as to how to enter a new blank line in an array
.
.
.
.
end sub()