创建查找和复制的VBA宏? [英] Create a VBA macro that Find and Copy?

查看:132
本文介绍了创建查找和复制的VBA宏?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要一个Excel的宏帮助。

I need a little bit help with a macro of Excel.

我需要创建一个宏,自动找到用户并复制我在另一个中的值表单:

I need to create a macro that automatically find users and copy the values that i have in an other Sheet:

我有一张表格包含用户及其杀戮和死亡,我创建了3张(3组不同的用户),我需要宏复制值自动查找用户和复制值。

I have one sheet with values that contains the Users and their Kills and Deaths, I create 3 sheets more (3 different groups of users), and I need that the macro copy values automatically finding the users and copying values.

图像更好地描述:

----(复制此值) --->

----(Copy this values on)----->


推荐答案

您不需要使用宏工作表函数 VLOOKUP 是足够的。

You don't need a macro for this, using the worksheetfunction VLOOKUP is sufficient.

举个例子,如果你的第1行中的标头和列A中的用户,你将放入单元格B2(数字对于第一个用户而言)将是 = VLOOKUP($ A2; Values!$ A $ 2:$ C $ 9; 2; FALSE),C2将为 = VLOOKUP($ A2; Values!$ A $ 2:$ C $ 9; 3; FALSE)

As an example, if you have your headers in row 1 and users in column A, what you'd put into cell B2 (the number of kills for the first user) would be =VLOOKUP($A2;Values!$A$2:$C$9;2;FALSE) and C2 would be =VLOOKUP($A2;Values!$A$2:$C$9;3;FALSE).

(您还可以在链接的文档中找到)是:

The arguments for the function (which you can also find in the linked document) is:


  • 首先,您正在寻找的价值在A2

  • 接下来,您要从 - vlookup 返回结果的值数组将仅在第一列中查看,但因为您要从其他列中返回结果,因此我们在公式中包含列A:C。

  • 您搜索的范围中返回结果的列为列2,为死亡科鲁mn 3。

  • 最后是否要完全匹配( false )或者大概一个可以( true )。

  • First, the value you're looking for, in your case whatever is in A2
  • Next the array of values which you want to return a result from - vlookup will only look through the first column, but since you want to return results from the other columns we include columns A:C in the formula.
  • What column in the range you search to return the result from for kills it is column 2, for deaths column 3.
  • Finally whether you want to have an exact match (false) or if an approximate one is ok (true).

这篇关于创建查找和复制的VBA宏?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆