I am a naive user of VBA and I am looking for a VBA macro which would do the following task
我是一个单纯的VBA用户,我正在寻找一个VBA宏,它可以完成以下任务
- Delete 3 tabs from the file and delete the first 6 rows from remanining tabs.
- 从文件中删除3个选项卡,从remanining选项卡中删除前6行。
- Perform this for all the excel files (2013) and save as xlsx in the same or different file folder.
- 对所有excel文件(2013)执行此操作,并将xlsx保存到相同或不同的文件夹中。
I tried the code available on this link Run same excel macro on multiple excel files
我尝试了这个链接上的代码,在多个excel文件上运行相同的excel宏。
At the line Filename=Dir(Pathname & "*.xlsx")
, I am getting an error which says run time error "52" Bad file name or number
.
在行文件名=Dir(路径名& "*.xlsx")中,我得到一个错误,它说运行时错误"52"坏文件名或编号。
I have changed this:
我改变了这个:
Pathname = "\C:\Users\Desktop\test\try\"\
Is this correct?
这是正确的吗?
1 个解决方案
#1
1
Not sure if it's your only problem, but
不确定这是否是你唯一的问题,但是。
\C:\Users\Desktop\test\try\
桌面\ \ C:\ \用户测试\ \
should be
应该是
C:\Users\Desktop\test\try\
(without the first backslash)
C:\Users\Desktop\test\try\(没有第一个反斜杠)
*I realize this should be a comment--I'm under 50 rep, however.
我意识到这应该是一个评论——不过我还不到50岁。
#1
1
Not sure if it's your only problem, but
不确定这是否是你唯一的问题,但是。
\C:\Users\Desktop\test\try\
桌面\ \ C:\ \用户测试\ \
should be
应该是
C:\Users\Desktop\test\try\
(without the first backslash)
C:\Users\Desktop\test\try\(没有第一个反斜杠)
*I realize this should be a comment--I'm under 50 rep, however.
我意识到这应该是一个评论——不过我还不到50岁。