VBA编辑抱怨缺少对象

时间:2015-06-01 14:46:54

标签: vba excel-vba excel

出于某种原因,VBE告诉ConcatenateRows需要一个对象,我不太清楚为什么,立即窗口告诉我Option Explicit Private ConsolidateRange As Range Private Sub CancelButton_Click() RangeConsiolidateForm.Show End Sub Private Sub RangeInput_Change() Set ConsolidateRange = Range(RangeInput) End Sub Private Sub UserForm_Initialize() Direction.AddItem "Rows" Direction.AddItem "Columns" End Sub Private Sub OkButton_Click() If Direction = "Rows" Then ConcatenateRows (ConsolidateRange) RangeConsiolidateForm.Show End If End Sub 是一个范围:

Public Sub ConcatenateRows(InputRange as range)
....bunch of code....
End Sub

{{1}}

更新:我得到的错误是"运行时错误'':需要对象"

1 个答案:

答案 0 :(得分:4)

尝试更改通话

ConcatenateRows (ConsolidateRange)

ConcatenateRows ConsolidateRange

这是一个旧的VBA捕获程序调用新手。