将列H中的每隔一行的单元格数据移动到I,并replaceB和C中的文本

我是macros的新手,需要1000+以上的线表:

我有一个工作表,我需要复制每隔一行,然后修改新的行。

复制额外的行我运行这个macros:

Sub CopyRows() Dim LR As Long Dim i As Long LR = Cells.Find(What:="*", After:=[A1], SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row For i = LR To 2 Step -1 Rows(i).Copy Range(Rows(i + 1), Rows(i + 1)).Insert Shift:=xlDown Application.CutCopyMode = False Next i End Sub 

在标题行之后的每隔一行,我需要做两个额外的操作。

操作1:在B和CI列中,需要用“B的数据”和“C的数据”replace文本,每个replace文本都是静态的。

操作2:我需要删除H列中的数据并粘贴到第一列。

任何帮助做这个macros,将不胜感激。

这是在Excel 2016中

我的最终解决scheme感谢@MortenAnthonsen他的解决scheme给了我需要做的以下工作:

 Sub myMaker() Dim LR As Long Dim i As Long LR = Cells.Find(What:="*", After:=[A1], SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row For i = LR To 2 Step -1 Rows(i).Copy Range(Rows(i + 1), Rows(i + 1)).Insert Shift:=xlDown Application.CutCopyMode = False Next i For i = 3 To Cells(2, 2).End(xlDown).Row Step 2 Cells(i, 2).Value = "B Data" Cells(i, 3).Value = "C Data" Range("H" & i).Select Selection.Cut Range("I" & i).Select ActiveSheet.Paste Next i End Sub 

这应该做的伎俩

 Sub operations() Dim i As Integer For i = 2 To Cells(2, 2).End(xlDown).Row Step 2 Cells(i, 2).Value = "data for B" Cells(i, 3).Value = "Data for C" Next i Range(Range("H2"), Range("H2").End(xlDown)).Cut Destination:= _ Range(Range("H2"), Range("H2").End(xlDown)).Offset(0, 1) End Sub