VBA code and data concatenation

xicosantos

New Member
Joined
Feb 5, 2015
Messages
12
Hello I wonder that someone can help me?
I have a folder with several photos (jpg and png) whose names are numbers and letters


eg
12345.jpg
12345a.jpg
12345b.jpg
12345c.png
9876.png
9876a.png
9876b.jpg etc.


and I was wondering how to make an application in vba to list all the photos names in that folder and then put in the same cell the names whose initial digits are the same and separated by a comma.
eg


Cell 1 = 12345.jpg, 12345a.jpg, 12345b.jpg, 12345c.png
Cell 2 = 9876.png, 9876a.png, 9876b.jpg
Etc.


Is it possible to do?
Someone can help me? Thanks in advanced
 
Yes thats correct. SKU all capital letters always and the instances letters as many as they are always lower cases.
 
Upvote 0

Excel Facts

Is there a shortcut key for strikethrough?
Ctrl+S is used for Save. Ctrl+5 is used for Strikethrough. Why Ctrl+5? When you use hashmarks to count |||| is 4, strike through to mean 5.
Yes thats correct. SKU all capital letters always and the instances letters as many as they are always lower cases.
But my question was, said another way... do you have SKU's that consist only of letters (no digits)?
 
Upvote 0
Yes that's exactly right. The SKU all capital letters, always, in case they are just letters and the instances, be they many or few, will always be a letter only and always lowercase. Thank you
 
Upvote 0
Sorry... can happen sku be only letters .. but as I said, I can change in order to facilitate the code. I do not want to give you a lot of work though I know that a challenge is always good to overcome. thanks a lot
 
Upvote 0
But my question was, said another way... do you have SKU's that consist only of letters (no digits)?


Hello Rick, as I said if it is too complicated or that the code get too heavy I can make the name of the photos just with numbers and the only characters are the characters of the different instances of the products. Thanks again for your willingness and patience. Thank U
 
Upvote 0
Hello Rick, as I said if it is too complicated or that the code get too heavy I can make the name of the photos just with numbers and the only characters are the characters of the different instances of the products. Thanks again for your willingness and patience. Thank U
Question 1: Could you ever have a file name like 12345a.jpg without there being a file named 12345.jpg (without the small letter)?

Question 2: Could a .jpg and a .png file ever have the same name (before the dot)? For example, could you ever have 12345.jpg and 12345.png in the same folder? If so, how would the concatenations be handled for 12345a.jpg and 12345a.png?
 
Upvote 0
Question 1: Could you ever have a file name like 12345a.jpg without there being a file named 12345.jpg (without the small letter)?

Question 2: Could a .jpg and a .png file ever have the same name (before the dot)? For example, could you ever have 12345.jpg and 12345.png in the same folder? If so, how would the concatenations be handled for 12345a.jpg and 12345a.png?


Question 1: No, never .. the instances will always be sequential. If there is a 12345a.jpg (or png) will have to exist a 12345.jpg (or png). If there is a 12345c.jpg (or png) must exist a 12345.jpg (or png) and 12345a.jpg (or png) and 12345b.jpg (or png).

Question 2: No, there are only one name for each instance. If there is a 12345.jpg there will be no 12345.png. If there is a 12345a.jpg there will be no 12345a.png. What could happen is in each product the different instances are the same type (jpg or png) or be a combination of both types, but always have different names (name = all before the dot)
 
Upvote 0
Question 1: No, never .. the instances will always be sequential. If there is a 12345a.jpg (or png) will have to exist a 12345.jpg (or png). If there is a 12345c.jpg (or png) must exist a 12345.jpg (or png) and 12345a.jpg (or png) and 12345b.jpg (or png).

Question 2: No, there are only one name for each instance. If there is a 12345.jpg there will be no 12345.png. If there is a 12345a.jpg there will be no 12345a.png. What could happen is in each product the different instances are the same type (jpg or png) or be a combination of both types, but always have different names (name = all before the dot)

Hello Rick... do you have any news for me? :)
Thank you
Xico
 
Upvote 0

Forum statistics

Threads
1,223,236
Messages
6,170,912
Members
452,366
Latest member
TePunaBloke

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