每个“变量”行数插入“一个”空行 - 包括LOOP?

时间:2018-02-12 16:55:19

标签: vba

任何人都可以建议我如何将RowIncrement = 2变成一个“循环”,然后根据另一个工作表从列中获取值?因此,如果列中的第一个值是1然后是RowIncrement = 1,那么它将转到该列中的下一个值,该值可以是例如1。 6然后RowIncrement = 6等等。

Sub EmptyRowEveryX()

Dim NumRowsToInsert As Long
Dim RowIncrement As Long
Dim ws As Excel.Worksheet
Dim LastRow As Long
Dim LastEvenlyDivisibleRow
Dim i As Long
Dim z As Long
Dim HowMany As Integer

NumRowsToInsert = 1


RowIncrement = 2

Set ws = ActiveSheet

For n = LastRow To 1 Step -1

HowMany = Range("BM" & z)

If (HowMany > 1) Then

Rows(z & ":" & HowMany).Insert Shift:=xlDown

End If

With ws
    LastRow = .Range("AZ" & .Rows.count).End(xlUp).Row
    LastEvenlyDivisibleRow = Int(LastRow / RowIncrement) * RowIncrement
    If LastEvenlyDivisibleRow = 0 Then
        Exit Sub
    End If




    For i = LastEvenlyDivisibleRow To 1 Step -RowIncrement
        .Range(i & ":" & i + (NumRowsToInsert - 1)).Insert xlShiftDown
    Next i



End With
Application.ScreenUpdating = True
End Sub

1 个答案:

答案 0 :(得分:1)

componentDidMount(){
   getGraphData('mydomain', 'myuserId', 'mytestId').then((res) => {
       const modifiedData = dataObj(res);
       this.setState({ data: modifiedData });
   }
}
相关问题