简体   繁体   English

Excel宏可将数据从一个表移动到另一列,并基于列名和单元格内容

[英]Excel macro to move data from one sheet to another based column name and cell content

I have a worksheet1 with a column labeled participant and columns labeled 1-20 (experiment ID numbers). 我有一个工作表1,其中的一列标记为参与者,一列标记为1-20(实验ID号)。

I have another worksheet2 with data of participants (column) and the experiments (column) they participated in. 我还有另一个工作表2,其中包含参与者(列)和他们参与的实验(列)的数据。

What I need to do is place an "X", on worksheet1, in the corresponding cells from worksheet2. 我需要做的是在worksheet1上的worksheet2的相应单元格中放置一个“ X”。

Here are some images that show what I mean: 以下是一些图片,这些图片说明了我的意思:

在此处输入图片说明

在此处输入图片说明

You should use a pivot table. 您应该使用数据透视表。 It will get you exactly what you are looking for. 它会为您提供所需的确切信息。

Row Label: Participant
Col Label: Experiment
Values: Count of Experiment

Then you would need to change all the "1"s to "X" with find/replace (either manually or with macro): 然后,您需要使用查找/替换(手动或使用宏)将所有的“ 1”更改为“ X”:

Range(pivottablecells).Replace("1", "X")

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 VBA宏可根据单元格内容将单元格移动到新的Excel表 - VBA macro to move cells to a new sheet Excel based on cell content Macro Excel可根据单元格匹配将范围单元格从一张纸复制到另一张纸,如果不匹配,则跳过单元格 - Macro Excel to copy range cells from one sheet to another based on cell match and skip cell if no match 使用VBA根据列名将数据从一个Excel工作表复制到另一个(复杂)工作表 - Copy data from one excel sheet to another (complex) using VBA based on column name Excel宏可根据单元格值将一行中的选定单元格从一张纸复制到另一张纸 - Excel Macro to copy select cells from a row from one sheet to another based upon a cell value Excel宏复制单元格范围并将数据粘贴到另一个工作表 - Excel Macro Copy cell range & paste data one sheet to another Excel宏-根据值将单元格从一张纸复制到另一张纸 - Excel Macro - copy cells from one sheet into another based on value Excel宏可根据特定的匹配条件将数据从一张纸复制到另一张纸 - Excel macro to copy data from one sheet to another based on specific matching conditions VBA根据参考单元格中的匹配值将数据从一个范围移动到另一个图纸范围 - VBA move data from one range to another sheet range based on matching values in reference cell Excel VBA 根据第二列单元格值将列从一张表复制到另一张表 - Excel VBA to Copy Column from one sheet to another based on a second columns cell value excel根据另一个单元格值从另一个工作表中提取数据 - excel pulling data from another sheet based on another cell value
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM