Substitution and removing of the string

topi1

Active Member
Joined
Aug 6, 2014
Messages
252
Office Version
  1. 2010
I need a VBA for the following if someone can please help. Thank you in advance,

The data is in the column R.
Case insensitive match.
There are intermittent blank rows, but they can be removed first if absolutely necessary.

Function 1 of the VBA:
In all cells BELOW the cell that contains "TITLE2", I would like " shows" and " show" to be substituted with ":". Please notice that the preceding space is included. " shows" and " show" are part of the strings.
Function 2 of the VBA:
In all cells ABOVE the cell that contains "TITLE2", I would like " shows" and " show" as well everything to their left removed.

Here is the example.

BEFORE:

Book1
R
1Movies
2TITLE1
3
4Eros shows Star Wars
5Strand and Regal show Superman.
6
7TITLE2
8Eros shows Star Wars
9Strand and Regal show Superman.
Sheet2


AFTER (DESIRED OUTPUT):

Book1
R
1Movies
2TITLE1
3
4Eros: Star Wars
5Strand and Regal: Superman.
6
7TITLE2
8Star Wars
9Superman.
Sheet2
 
I forgot to mention, you should have "Option Compare Text" at the top of your module also for the required case insensitive match.
Code:
Option Explicit
Option Compare Text
 
Upvote 0

Excel Facts

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand

Forum statistics

Threads
1,223,886
Messages
6,175,191
Members
452,616
Latest member
intern444

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