VBA连接2列

时间:2014-03-13 04:18:00

标签: vba

如何连接A列和B列以创建C列?

A    B  
abc  jkl 
def  mno 
ghi  pqr 

C列应为:

C
abc
def
ghi
jkl
mno
pqr

1 个答案:

答案 0 :(得分:1)

这就是您要找的东西

Sub testing()
Dim lrow1 As Long
Dim lrow2 As Long

With ActiveSheet
lrow1 = .Range("A" & Rows.Count).End(xlUp).Row
lrow2 = .Range("B" & Rows.Count).End(xlUp).Row

.Range("A1:A" & lrow1).Copy .Range("C1")
.Range("B1:B" & lrow2).Copy .Range("C" & lrow1 + 1)

End With

End Sub

我运行此宏.got以下结果

enter image description here