需要将多个Excel文件合并到一个包含条件的主工作表中 [英] Need to merge multiple excel files into one master-worksheet with conditions
问题描述
嗨Excel-pros,
Hi Excel-pros,
我有6个excel文件跟我一起显示订阅和联合的数据 - 我博客的订阅用户。现在我需要将它们全部合并到一个工作表中,还需要从中删除重复项。另外,需要自动化一个条件,如果任何email-id在
我的任何未描述的列表/文件中,它应该在master-worksheet的列中说'no',对于订阅的列表/文件'yes' 。
I've 6 excel files with me that shows the data of subscribed and un-subscribed users of my blog. Now I need to merge all-of-them into one worksheet and also need to remove duplicates from it. Plus, need to automate a condition, if any of the email-id is in my any unsuscribed list/file it should say 'no' in a column in master-worksheet and 'yes' for the subscribed list/file.
有人可以分享他们的输入并帮助我完成"操作方法"任务。
Can someone please share their inputs and help me in 'how-to' task for it.
任何帮助都将受到高度赞赏。
Any help will be highly appreciated.
干杯,
Rishu Mehra
Cheers,
Rishu Mehra
Rishu Mehra Microsoft Influencer
Rishu Mehra Microsoft Influencer
推荐答案
只需在工作簿中添加一个名为Master的工作表。请务必先保存文件,否则表格名称将无法通过
Sub CombineData()
Dim Sht As Worksheet
For Each Sht In ActiveWorkbook.Worksheets
如果Sht.Name<> "万事达"然后
Sht.Select
范围("A:A")。插入¥b $ b范围("A2")。公式=" ; =中(细胞(QUOT;"文件名"",B1),查找(""]"",细胞(QUOT;"文件名""))+ 1255)"
范围("A2")。复制
范围("A2")。PasteSpecial Paste:= xlPasteValues
范围("A2:K2" ;)。复制
表格("Master")。选择
范围("A65536")。结束(xlUp)。偏移(1,0)。选择
ActiveSheet.Paste
Sht.Select
范围("A:A")。删除
Else
结束如果
Next Sht
Just add a sheet in to your workbook called Master. Make sure you save the file first or the sheet names will not pull through
Sub CombineData()
Dim Sht As Worksheet
For Each Sht In ActiveWorkbook.Worksheets
If Sht.Name <> "Master" Then
Sht.Select
Range("A:A").Insert
Range("A2").Formula = "=Mid(Cell(""filename"",B1),Find(""]"",Cell(""filename""))+1,255)"
Range("A2").Copy
Range("A2").PasteSpecial Paste:=xlPasteValues
Range("A2:K2").Copy
Sheets("Master").Select
Range("A65536").End(xlUp).Offset(1, 0).Select
ActiveSheet.Paste
Sht.Select
Range("A:A").Delete
Else
End If
Next Sht
这篇关于需要将多个Excel文件合并到一个包含条件的主工作表中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!