我无法将两列(变量范围)连接到同一文档中的另一列。有什么东西真的很明显我不见了吗?
Function ConcCol(ConVal_1 As String, ConVal_2 As String)
Range("V30:V500").Select
Application.CutCopyMode = False
With ActiveCell
.FormulaR1C1 = "=CONCATENATE(RC[5],"" "",RC[6])"
End With
Selection.AutoFill Destination:=Range(Destination), Type:=xlFillDefault
End Function
运行上述功能时,出现以下错误:
错误:运行时错误'1004':Range类的自动填充方法失败
我认为这只与一个被激活的细胞有关吗?我的VBA知识有限
答案 0 :(得分:0)
Sub ConcCol()
Range("V3:V500").Select
For Each Cell In Selection
Cell.Value = "=CONCATENATE(RC[5],"" "",RC[6])"
Next Cell
End Sub
我认为只使用每个细胞会更容易(如果你选择了选择的想法)。我认为你的with语句根本不想循环,因此错误。这是一个简单的解决方案。
答案 1 :(得分:0)
我认为这就是你要找的东西:
Sub tgr()
With Intersect(ActiveSheet.UsedRange.EntireRow, Range("V30:V" & Rows.Count))
.Formula = "=AA" & .Row & "&"" ""&AB" & .Row
End With
End Sub
答案 2 :(得分:0)
为了您的目的,为什么用户不在表格中使用CONCATENANTE功能并填写?
也许使用Excel数组函数?
我无法发布图片,需要10个声誉:s