Burrgogi
Active Member
- Joined
- Nov 3, 2005
- Messages
- 495
- Office Version
- 2010
- Platform
- Windows
In col. B, I have the following:
apples1_hw.jpg
apples2_hw.jpg
chartsa_hw.jpg
chartsb_hw.jpg
chartsc_hw.jpg
travelagenda_hw.jpg
cooler_x1.jpg
toys_x1.jpg
38425816_7928501.jpg
In col. E, I want the following result:
_layer1.jpg
_layer2.jpg
_layer1.jpg
_layer2.jpg
_layer3.jpg
_layer.jpg
_cover.jpg
_cover.jpg
_cover.jpg
Basically everything will end with _layer.jpg. There are some variations of course. Apples1_hw.jpg; Apples2_hw.jpg etc...
So in Col E, it should say _layer1.jpg; _layer2.jpg. Same thing with the "charts" example. There is a 'a' 'b' & 'c' at the end of the word charts. So in col. E, it should say _layer1.jpg; _layer2.jpg; _layer3.jpg.
I recorded a very simple macro:
Find: *1_hw.txt
Replace with: _layer1.jpg
Find: *2_hw.jpg
Replace with: _layer2.jpg
Find: *3_hw.jpg
Replace with: _layer3.jpg
Find: *a_hw.jpg
Replace with: _layer1.jpg
Find: *b_hw.jpg
Replace with: _layer2.jpg
Find: *c_hw.jpg
Replace with: _layer3.jpg
Here's the problem. Not everthing will be a series such as "chartsa, chartsb, chartsc...". If you look at the example above
"travelagenda_hw.jpg" The word "agenda" just so happens to end in the letter 'a'. So my find & replace will not work because it's going to give me: _layer1.jpg which is not the desired result.
2nd part of this problem:
The very last item the list (col A) is:
3425816_7928501.jpg
I don't know of any suitable "find & replace" that will give me:
_cover.jpg
Is there anyone that would be willing to write a VBA routine that will solve these problems for me??
apples1_hw.jpg
apples2_hw.jpg
chartsa_hw.jpg
chartsb_hw.jpg
chartsc_hw.jpg
travelagenda_hw.jpg
cooler_x1.jpg
toys_x1.jpg
38425816_7928501.jpg
In col. E, I want the following result:
_layer1.jpg
_layer2.jpg
_layer1.jpg
_layer2.jpg
_layer3.jpg
_layer.jpg
_cover.jpg
_cover.jpg
_cover.jpg
Basically everything will end with _layer.jpg. There are some variations of course. Apples1_hw.jpg; Apples2_hw.jpg etc...
So in Col E, it should say _layer1.jpg; _layer2.jpg. Same thing with the "charts" example. There is a 'a' 'b' & 'c' at the end of the word charts. So in col. E, it should say _layer1.jpg; _layer2.jpg; _layer3.jpg.
I recorded a very simple macro:
Find: *1_hw.txt
Replace with: _layer1.jpg
Find: *2_hw.jpg
Replace with: _layer2.jpg
Find: *3_hw.jpg
Replace with: _layer3.jpg
Find: *a_hw.jpg
Replace with: _layer1.jpg
Find: *b_hw.jpg
Replace with: _layer2.jpg
Find: *c_hw.jpg
Replace with: _layer3.jpg
Here's the problem. Not everthing will be a series such as "chartsa, chartsb, chartsc...". If you look at the example above
"travelagenda_hw.jpg" The word "agenda" just so happens to end in the letter 'a'. So my find & replace will not work because it's going to give me: _layer1.jpg which is not the desired result.
2nd part of this problem:
The very last item the list (col A) is:
3425816_7928501.jpg
I don't know of any suitable "find & replace" that will give me:
_cover.jpg
Is there anyone that would be willing to write a VBA routine that will solve these problems for me??