Copying cells from one workbook to another and saving an individual file for each cell

Andyg666

New Member
Joined
Apr 24, 2024
Messages
27
Office Version
  1. 365
Platform
  1. Windows
Hi,
I am new to macros but hope you can help me.
I have a list of items and related information (model, serial number etc) and I need a macro so that I can press a button and export the item name and serial number of each item into another workbook for each item on the original list including a pop up option of where these new workbooks would be saved.

I hope this makes sense, please help
 
Thanks ........ however it works for the first for lines but then gives an error
Run-time error '1004':
Method 'saveAs' of object '_Workbook' failed
ERROR.png

What is this then? As you can tell I am clueless :)
 
Upvote 0

Excel Facts

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.
Make sure that the data in C3 & C4 & C5 & H3 does not reproduce duplicate file names.
 
Upvote 0
Thanks ........ however it works for the first for lines but then gives an error
Run-time error '1004':
Method 'saveAs' of object '_Workbook' failed
View attachment 114593
What is this then? As you can tell I am clueless :)
Hi,
I think the file name is to long and i gives this error and then stops
Make sure that the data in C3 & C4 & C5 & H3 does not reproduce duplicate file names.
Hi,
I'm thinking the file name is to long and it gives this error and then stops
 
Upvote 0
You can have up to 260 characters including the extension so I don't think that's the problem. Did you delete the question marks? Are any files being saved?
 
Upvote 0
You can have up to 260 characters including the extension so I don't think that's the problem. Did you delete the question marks? Are any files being saved?

It is the file name length
If I change the name in the data file so its no as long it works until it gets to the next error.

I don't think the file name would of been 260 characters long but I would need to check but if I go to the file it created and rename to put the longer file name in manually it works. ????

Yes I have removed all the question marks.
 
Upvote 0
I removed all the question marks and ran the macro and it created all 7 files correctly using the 2 files you posted. Are you using the macro on different files?
 
Upvote 0
I removed all the question marks and ran the macro and it created all 7 files correctly using the 2 files you posted. Are you using the macro on different files?
it works but then has an issue with the filename length as when I reuse the text in the data then it works and moves on to the next.

The file length is about 99 characters????
 
Upvote 0
It should accept up to 260 characters.
 
Upvote 0

Forum statistics

Threads
1,223,908
Messages
6,175,306
Members
452,633
Latest member
DougMo

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top