excel宏 我想在某些单元格下面插入列循环进行,类似这种 直到一百次(N次)如何修改 高分求助!

(这两个是选择的或者是指定的某行With Rows("35:35"), Range("E37").Select
Sub 新插入()
'
' 新插入 Macro
' 宏由 ibm 录制,时间: 2015/01/14
'

'
With Rows("35:35")
.Insert Shift:=xlShiftDown
.Select
End With
Range("E37").Select
With Rows("37:37")
.Insert Shift:=xlShiftDown
.Select
End With
Range("E39").Select
With Rows("39:39")
.Insert Shift:=xlShiftDown
.Select
End With
Range("E41").Select
With Rows("41:41")
.Insert Shift:=xlShiftDown
.Select
End With
Range("E43").Select
With Rows("43:43")
.Insert Shift:=xlShiftDown
.Select
End With
Range("E45").Select
With Rows("45:45")
.Insert Shift:=xlShiftDown
.Select
End With
End Sub

第1个回答  2015-01-14
Sub a()
    Dim lIndex As Long
    Dim n As Long   '循环次数
    n = 100 '循环100次
    
    For lIndex = 0 To n - 1
        With Rows(35).Offset(lIndex * 2)
            .Insert Shift:=xlShiftDown
            .Select
        End With
    Next lIndex
    
End Sub

第2个回答  2015-01-14
根据你给的数据是隔行插入,起始行是35,则以下代码可以实施
Sub tsxt()
Dim I, J, K As Integer
I = 35
Do While J <= 100
With Rows(I)
.Insert Shift:=xlShiftDown
.Select
End With
J = J + 1
I = I + 2
Loop

End Sub本回答被提问者和网友采纳
第3个回答  2015-01-14
你是想让你的这个代码运行100次是吧,如果是,加上For x = 1 To 100
Next x就行了
相似回答