将A列和B列的内容按照A1-B1,A2-B2进行合并

vba代码:

For j = 1 To Range("A" & Rows.Count).End(xlUp).Row * 2 + 1
For I = 1 To Range("A" & Rows.Count).End(xlUp).Row
 Cells(j, 4) = Cells(I, 1)
 j = j + 2
 Next
 Next
 For j = 1 To Range("B" & Rows.Count).End(xlUp).Row * 2 + 1
For I = 1 To Range("B" & Rows.Count).End(xlUp).Row
 Cells(j + 1, 4) = Cells(I, 2)
 j = j + 2
 Next
 Next

  

 

 注:代码为网友提供,感谢朋友提高的代码

posted on 2021-03-13 22:04  tongxiaohu  阅读(440)  评论(0编辑  收藏  举报

导航