首页 \ 问答 \ VBA Excel - IFERROR和VLOOKUP错误(VBA Excel - IFERROR & VLOOKUP error)

VBA Excel - IFERROR和VLOOKUP错误(VBA Excel - IFERROR & VLOOKUP error)

我正在尝试在excel VBA中创建等效的= IFERROR(VLOOKUP(), - 1)公式,其中函数将在我的数据表中查找文本,如果文本在表中,则返回第5列中的数字如果不是,则为-1。 我已经在excel中测试了上面的公式,它给了我想要的结果问题是当我在VBA中编码时我一直得到#VALUE! 如果文本不在表中,则会出错。 如果文本在表中,代码将生成所需的数字。 我的代码如下:

Function CCC(A As Variant)
Dim B As Variant
B = Application.WorksheetFunction.IfError(Application.WorksheetFunction.VLookup(A, Sheets("DAP").Range("$B$4:$X$7"), 5, False), -1)
CCC = B
End Function

考虑到这一点,有没有办法修复代码,以便IFERROR(VLOOKUP)工作,如果不是什么是在VBA中实现相同结果的最佳替代方案?


I'm trying to create the equivalent of the =IFERROR(VLOOKUP(),-1) formula in excel VBA where the function would look up text in my data table and return the number in the 5th column if the text is in the table and -1 if it isn't. I've tested the above formula in excel and it gives me the desired result the problem is when I go to code it in VBA I keep getting the #VALUE! error if the text is not in the table. The code produces the desired number if the text is in the table. My code is as follows:

Function CCC(A As Variant)
Dim B As Variant
B = Application.WorksheetFunction.IfError(Application.WorksheetFunction.VLookup(A, Sheets("DAP").Range("$B$4:$X$7"), 5, False), -1)
CCC = B
End Function

With that in mind, is there a way to fix the code so that the IFERROR(VLOOKUP) works and if not what is the best alternative to achieve the same result in VBA?


原文:https://stackoverflow.com/questions/45508472
更新时间:2023-07-17 10:07

最满意答案

我建议你从这里开始: https//github.com/jerrysu/backbone-webpack-example

没有什么能阻止你使用Backbone和ES6,尽管你应该读到这个: http//benmccormick.org/2015/04/07/es6-classes-and-backbone-js/

我在webpack配置中看到的第一个问题是你的加载器缺少一个test表达式( http://webpack.github.io/docs/using-loaders.html#configuration


I'd suggest you start here: https://github.com/jerrysu/backbone-webpack-example

There's nothing preventing you using Backbone with ES6, though you should read this: http://benmccormick.org/2015/04/07/es6-classes-and-backbone-js/

The first problem I see with your webpack configuration is that your loader is missing a test expression (http://webpack.github.io/docs/using-loaders.html#configuration)

相关问答

更多
  • 这有几个原因: 1) Backbone是专门为Rails设计的,并且可以通过骨干网的帮助轻松集成。 尽管Knockout和Angular的模型 - 视图 - 视图模型(MVVM)模式可以很容易地并入Rails应用程序,而Backbone的MVC体系结构提供了一个组织级别,如果您的应用程序有很多异步页面更新,这种组织级别似乎很有必要。 以这个堆栈溢出页面为例: 如果您在Rails中构建了这个问题视图,那么您的问题show.html.erb,question_show.js,show.js.erb以及与此页面上 ...
  • 有些人在Rails社区中是知名的,有一本名为Backbone JS on Rails的预发行电子书。 我还没有购买访问权限,但目录看起来不错。 最近由Addy Osmani发布了“开发Backbone.js应用程序:构建更好的JavaScript应用程序” 。 There is a prerelease eBook called Backbone JS on Rails by some people who are well-known within the Rails community. I haven ...
  • define(["Backbone"], function(Backbone){ Backbone.ajax = function() { // Invoke $.ajaxSetup in the context of Backbone.$ Backbone.$.ajaxSetup.call(Backbone.$, { statusCode: { 401: function(){ ...
  • Backbone.js基本上是一个uber-light框架,允许您在MVC (模型,视图,控制器)中构建您的Javascript代码,其中... 模型是您的代码检索和填充数据的一部分, View是此模型的HTML表示(视模式变化而变化等) 和可选的Controller ,在这种情况下,您可以通过hashbang URL保存您的Javascript应用程序的状态,例如: http : //twitter.com/#search? q=backbone.js 我用Backbone发现的一些职业: 没有更多的Ja ...
  • 如果没有backbone.js,jQuery的服务器端后端是不是足够了? 当然,您可以使用jquery甚至是纯粹的javascript来自己构建应用程序。 这完全取决于你想要达到的复杂程度。 Backbone旨在创建丰富的单页应用程序。 因此,它提供了一种用于描述,分组和处理数据的结构化方法。 应用程序状态,模板化视图等的路由。例如,集合(模型)提供的不仅仅是数组。 它们可以直接绑定到您的视图,观察更改并使用非常少的“粘合”代码自动同步到服务器。 如果您要将大部分应用程序逻辑放在客户端的浏览器中,则需要保持 ...
  • 因此,对于单页面应用,我们需要考虑两种类型的页面:整页加载和单页面路由。 完整页面加载是用户首次到达您的站点时的入口点,但您还应考虑深入链接到站点中的URI以及当前URI的浏览器刷新。 简单方法 不要在node.js路由中查询数据库 只需返回“开始页面”HTML 在浏览器中,骨干路由器将初始化您的视图/集合/模型,然后从服务器fetch所需的数据并在浏览器中呈现页面。 让它先工作并理解细节,因为总体来说它是最不复杂的。 它确实导致感知性能的延迟,因为在完成第二轮到服务器加载数据之前页面将不可用。 此外,起始 ...
  • 我建议你从这里开始: https : //github.com/jerrysu/backbone-webpack-example 没有什么能阻止你使用Backbone和ES6,尽管你应该读到这个: http : //benmccormick.org/2015/04/07/es6-classes-and-backbone-js/ 我在webpack配置中看到的第一个问题是你的加载器缺少一个test表达式( http://webpack.github.io/docs/using-loaders.html#con ...
  • Backbone依赖于jQuery,如果你使用类似jQuery的另一个模块,比如zepto ,你需要将jquery作为别名。 来自Backbone wiki : 使用WebPack,可以使用resolve.alias配置选项: { context: __dirname + "/app", entry: "./entry", output: { path: __dirname + "/dist", filename: "bundle.js" } ...
  • jQuery模板插件已被删除,尚未进一步开发(请参阅https://github.com/jquery/jquery-tmpl )。 更好地使用其他内容甚至内置来强调_.template。 例如,有很多例子如何使用underscore.js作为模板引擎? The jQuery template plugin has been removed and is not further developed (see https://github.com/jquery/jquery-tmpl). Better use ...
  • extjs是一个重量级的解决方案,extjs完全支持mvc架构; 骨干是一种非常轻量级的解决方案,两者通常都不需要共存。 extjs is a heavyweight solution, and extjs has full support for mvc architecture; backbone is a very lightweight solution, both of which generally do not need to co-exist it.

相关文章

更多

最新问答

更多
  • 获取MVC 4使用的DisplayMode后缀(Get the DisplayMode Suffix being used by MVC 4)
  • 如何通过引用返回对象?(How is returning an object by reference possible?)
  • 矩阵如何存储在内存中?(How are matrices stored in memory?)
  • 每个请求的Java新会话?(Java New Session For Each Request?)
  • css:浮动div中重叠的标题h1(css: overlapping headlines h1 in floated divs)
  • 无论图像如何,Caffe预测同一类(Caffe predicts same class regardless of image)
  • xcode语法颜色编码解释?(xcode syntax color coding explained?)
  • 在Access 2010 Runtime中使用Office 2000校对工具(Use Office 2000 proofing tools in Access 2010 Runtime)
  • 从单独的Web主机将图像传输到服务器上(Getting images onto server from separate web host)
  • 从旧版本复制文件并保留它们(旧/新版本)(Copy a file from old revision and keep both of them (old / new revision))
  • 西安哪有PLC可控制编程的培训
  • 在Entity Framework中选择基类(Select base class in Entity Framework)
  • 在Android中出现错误“数据集和渲染器应该不为null,并且应该具有相同数量的系列”(Error “Dataset and renderer should be not null and should have the same number of series” in Android)
  • 电脑二级VF有什么用
  • Datamapper Ruby如何添加Hook方法(Datamapper Ruby How to add Hook Method)
  • 金华英语角.
  • 手机软件如何制作
  • 用于Android webview中图像保存的上下文菜单(Context Menu for Image Saving in an Android webview)
  • 注意:未定义的偏移量:PHP(Notice: Undefined offset: PHP)
  • 如何读R中的大数据集[复制](How to read large dataset in R [duplicate])
  • Unity 5 Heighmap与地形宽度/地形长度的分辨率关系?(Unity 5 Heighmap Resolution relationship to terrain width / terrain length?)
  • 如何通知PipedOutputStream线程写入最后一个字节的PipedInputStream线程?(How to notify PipedInputStream thread that PipedOutputStream thread has written last byte?)
  • python的访问器方法有哪些
  • DeviceNetworkInformation:哪个是哪个?(DeviceNetworkInformation: Which is which?)
  • 在Ruby中对组合进行排序(Sorting a combination in Ruby)
  • 网站开发的流程?
  • 使用Zend Framework 2中的JOIN sql检索数据(Retrieve data using JOIN sql in Zend Framework 2)
  • 条带格式类型格式模式编号无法正常工作(Stripes format type format pattern number not working properly)
  • 透明度错误IE11(Transparency bug IE11)
  • linux的基本操作命令。。。