vlookup函数定义和计算机方式,应用程序定义或对象定义错误1004和错误438使用vlookup公式(Application defined or object defined error 100...

I am trying to use the vlookup function on a range of cells, that looks up values in other sheets. However I ckeep getting a runtime error that says "application defined or object defined error."

ActiveSheet.Range("$A$1", Selection.End(xlDown)).RemoveDuplicates Columns:=1, _

Header:=xlYes

'In Summary Tab

Range("A1").CurrentRegion.Select

nRows = Selection.Rows.Count

' Places column headers in "Summary" tab

For iCounter = 2 To Sheets.Count

Sheets(iCounter).Select

Range("A1").CurrentRegion.Select

nCols = Selection.Columns.Count

For iColumn = 2 To nCols

Sheets(iCounter).Select

If (WorksheetFunction.IsNumber(Cells(2, iColumn)) = "TRUE") Then

Cells(1, iColumn).Select

Selection.Copy

Sheets("Summary").Select

ActiveCell.Offset(0, 1).PasteSpecial

Application.CutCopyMode = False

ActiveCell.Offset(1, 0).Select

ActiveCell.Resize(nRows - 1, 1).Select

Selection.Formula = "=vlookup(B2," & _

Range(sheets(icounter).selection).Address","& icolumn",false)"

End If

Next

Next

I also tried editing the vlookup formula to this, (with everything else the same):

Selection = Application.WorksheetFunction.VLookup( _

"B2", Sheets(iCounter).CurrentRegion.Select, iColumn, False)

But this gives error 438 "object doesn't support this property or method"

Even tried editing the vlookup to this but got the 1004 error again:

Selection = Application.WorksheetFunction.VLookup("B2",Sheets(iCounter).Range(Cells(1, 1), Cells(nCols, nRows)), iColumn, False)

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值