如何批量在同一文件夹下,对多个excel的文件里的表格进行批量处理,提取如1-6列的内存,其它的都删除?谢谢
2个回答
展开全部
使用宏,下面的代码是从当前excel表格所在文件夹下,依次打开所有的excel文件(限xls结尾的),
Dim fs As FileSearch, fp, fname, n
Set fs = Application.FileSearch
fp = ActiveWorkbook.Path
fs.LookIn = fp
fs.LookIn = fp
fs.Filename = "*.xls"
fs.Execute
ChDir (ThisWorkbook.Path)
For n = 1 To fs.FoundFiles.Count
fname = fs.FoundFiles(n)
Workbooks.Open (fname)
'这里填写打开每个表格以后要做的工作,像你的要求就是删除前六列以后的列
next
Dim fs As FileSearch, fp, fname, n
Set fs = Application.FileSearch
fp = ActiveWorkbook.Path
fs.LookIn = fp
fs.LookIn = fp
fs.Filename = "*.xls"
fs.Execute
ChDir (ThisWorkbook.Path)
For n = 1 To fs.FoundFiles.Count
fname = fs.FoundFiles(n)
Workbooks.Open (fname)
'这里填写打开每个表格以后要做的工作,像你的要求就是删除前六列以后的列
next
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询
广告 您可能关注的内容 |