如何将excel中几十个工作表中的某一列提取出来单独做一个excel
1个回答
2013-08-27
展开全部
假设这些份文件在一个文件夹中,且若打开某一文件,数据就能看见——即不用点其他sheet。建一新Excel,也存到该文件夹。仅打开该新Excel,同时按Alt+F11进入宏界面,点菜单的插入,模块,粘贴如下代码:
Sub Find()
Application.ScreenUpdating = False
Dim MyDir As String
dim i as integer
i = 1
MyDir = ThisWorkbook.Path & "\"
ChDrive Left(MyDir, 1) 'find all the excel files
ChDir MyDir
Match = Dir$("")
Do
If Not LCase(Match) = LCase(ThisWorkbook.Name) Then
Workbooks.Open Match, 0 'open
Range("F1:F999").copy
thisworkbook.activate
cells(1,i).select
activesheet.paste
Windows(Match).Activate
ActiveWindow.Close
i = i +1
End If
Match = Dir$
Loop Until Len(Match) = 0
Application.ScreenUpdating = True
End Sub
粗体的F表示你的某一列为F列,自己改。在此界面直接按F5运行此宏,完成。
Sub Find()
Application.ScreenUpdating = False
Dim MyDir As String
dim i as integer
i = 1
MyDir = ThisWorkbook.Path & "\"
ChDrive Left(MyDir, 1) 'find all the excel files
ChDir MyDir
Match = Dir$("")
Do
If Not LCase(Match) = LCase(ThisWorkbook.Name) Then
Workbooks.Open Match, 0 'open
Range("F1:F999").copy
thisworkbook.activate
cells(1,i).select
activesheet.paste
Windows(Match).Activate
ActiveWindow.Close
i = i +1
End If
Match = Dir$
Loop Until Len(Match) = 0
Application.ScreenUpdating = True
End Sub
粗体的F表示你的某一列为F列,自己改。在此界面直接按F5运行此宏,完成。
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询
广告 您可能关注的内容 |