请教高手一Excel函数问题,在线等!!
我现有三组数据,分别是10001顺延10000个,20001顺延10000个,30001顺延10000个,40001顺延10000个现在我想新合成一组数据达到以下要求如1...
我现有三组数据,分别是10001顺延10000个,20001顺延10000个,30001顺延10000个,40001顺延10000个现在我想新合成一组数据达到以下要求
如10001, 10002, 20001, 20002, 30001, 30002, 40001,10003,10004,20003,20004,30003,30004,40002,.........(每次前三组用二个,第四组只取一个)一直向下推,一直把前3个一万排完,也就是得到一个新的35000个的数据。第四组的有5000个未排完不管! 展开
如10001, 10002, 20001, 20002, 30001, 30002, 40001,10003,10004,20003,20004,30003,30004,40002,.........(每次前三组用二个,第四组只取一个)一直向下推,一直把前3个一万排完,也就是得到一个新的35000个的数据。第四组的有5000个未排完不管! 展开
2个回答
展开全部
我假设你的数据在ABCD4列.从A1:A10000,B1:B10000,C1:C10000,D1:D1000
按下ALT+F11
插入-模块,复制下列代码
按下F5
结果显示在F列
Sub aaaaa()
Dim A As Integer
Dim B As Integer, C As Integer, D As Integer, E As Integer
A = Range("A1").CurrentRegion.Rows.Count / 2
B = 1: C = 1: D = 1: E = 1
Range("f1").Select
For X = 1 To A
ActiveCell.Value = Cells(B, 1)
ActiveCell.Offset(1, 0).Select
ActiveCell.Value = Cells(B + 1, 1)
ActiveCell.Offset(1, 0).Select
ActiveCell.Value = Cells(C, 2)
ActiveCell.Offset(1, 0).Select
ActiveCell.Value = Cells(C + 1, 2)
ActiveCell.Offset(1, 0).Select
ActiveCell.Value = Cells(D, 3)
ActiveCell.Offset(1, 0).Select
ActiveCell.Value = Cells(D + 1, 3)
ActiveCell.Offset(1, 0).Select
ActiveCell.Value = Cells(E, 4)
ActiveCell.Offset(1, 0).Select
B = B + 2
C = C + 2
D = D + 2
E = E + 1
Next
End Sub
按下ALT+F11
插入-模块,复制下列代码
按下F5
结果显示在F列
Sub aaaaa()
Dim A As Integer
Dim B As Integer, C As Integer, D As Integer, E As Integer
A = Range("A1").CurrentRegion.Rows.Count / 2
B = 1: C = 1: D = 1: E = 1
Range("f1").Select
For X = 1 To A
ActiveCell.Value = Cells(B, 1)
ActiveCell.Offset(1, 0).Select
ActiveCell.Value = Cells(B + 1, 1)
ActiveCell.Offset(1, 0).Select
ActiveCell.Value = Cells(C, 2)
ActiveCell.Offset(1, 0).Select
ActiveCell.Value = Cells(C + 1, 2)
ActiveCell.Offset(1, 0).Select
ActiveCell.Value = Cells(D, 3)
ActiveCell.Offset(1, 0).Select
ActiveCell.Value = Cells(D + 1, 3)
ActiveCell.Offset(1, 0).Select
ActiveCell.Value = Cells(E, 4)
ActiveCell.Offset(1, 0).Select
B = B + 2
C = C + 2
D = D + 2
E = E + 1
Next
End Sub
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询