Hi can someone help me with a vba macro please. I want insert a row in row 1 sheet 1 to all the xlsm files in a folder. The xlsm files are called different names in the folder.
Hi can someone help me with a vba macro please. I want insert a row in row 1 sheet 1 to all the xlsm files in a folder. The xlsm files are called different names in the folder.
Try this:
Please Login or Register to view this content.
If I've helped you, please consider adding to my reputation - just click on the liitle star at the left.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~(Pride has no aftertaste.)
You can't do one thing. XLAdept
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~aka Orrin
Hi I get an error on this part of the code U = Dir(P)
But, if you have a workbook up, that seems impossible? Did you try it more than once? What does the error say?
Hi xladept, what do you mean by "If you have a workbook up"
I tried the code more then once and it said "run time error 52: Bad file name or number"
This is what I have in the active path: P = ActiveWorkbook.Path & "C:\Users\Administrator\Desktop\ANALYSIS\"
The xlsm files in the folder ANALYSIS are called B1.xlsm,B7.xlsm, B20, V3.xlsm, V19.xslm
Last edited by Roadhouse; 04-05-2018 at 09:08 AM.
If you've got the path specified get rid of the ActiveWorkbook.Path i.e. change:
to just:Please Login or Register to view this content.
because it was trying to do a double pathPlease Login or Register to view this content.
Hi xladept, that change worked thanks for your help. Is there any chance you can take a look at the other thread you replied too. The one where I have to call a macro to work on other workbooks?
You're welcome and thanks for the rep!
I made a change to that other routine
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks