如何编写一个查看特定值的宏,然后将其复制并粘贴到另一个工作表上的特定位置

时间:2020-12-27 02:28:28

I am new to writing VBA and I have had some trouble writing a code. I have searched through all the different questions people have asked with similar issues to mine and although there has been very similar questions asked I cannot find a way of applying them to my problem. I am creating a schedule based on a list of priorities. On one worksheet "Organisation Tab 2" I have assigned a rank number to each operation which needs scheduling. There are 35 ranks assigned.

我是编写VBA的新手,我在编写代码时遇到了一些麻烦。我已经搜索了人们提出的与我的类似问题的所有不同问题,虽然有一些非常相似的问题我无法找到将它们应用于我的问题的方法。我正在根据优先级列表创建计划。在一个工作表“组织标签2”上,我为每个需要安排的操作分配了一个排名编号。分配了35个等级。

I want the macro to look at the rank column (E) in "CMM schedule" and when it finds a specific value look at the "Organisation Tab 2" worksheet and copy and paste the cells of the rank value found at the location it finds the rank value in the "CMM schedule". E.g. If rank (column E) in "CMM schedule" is 5 then copy and paste the rows from rank 5 "Organisation Tab 2" worksheet at the location of where the value 5 was found in the "CMM schedule".

我希望宏查看“CMM计划”中的排名列(E),当它找到特定值时,查看“组织标签2”工作表并复制并粘贴在找到的位置找到的排名值的单元格“CMM计划”中的排名值。例如。如果“CMM计划”中的排名(列E)为5,则将排名5“组织标签2”工作表中的行复制并粘贴到“CMM计划”中找到值5的位置。

I hope this makes sense and appreciate somebodies help.

我希望这是有道理的,并感谢一些人的帮助。

1 个解决方案

#1


0  

You don't have to use VBA code. A formula such as:

您不必使用VBA代码。公式如:

=INDIRECT("A" & MATCH(RANK(D9,B:B,-1),B:B,FALSE))

will work. If you want to use VBA code a simple function is needed.

将工作。如果要使用VBA代码,则需要一个简单的功能。

What route do you want to use?

你想用什么路线?

#1


0  

You don't have to use VBA code. A formula such as:

您不必使用VBA代码。公式如:

=INDIRECT("A" & MATCH(RANK(D9,B:B,-1),B:B,FALSE))

will work. If you want to use VBA code a simple function is needed.

将工作。如果要使用VBA代码,则需要一个简单的功能。

What route do you want to use?

你想用什么路线?