FIND & REPLACE rows of text in an Excel worksheet

afterdinnerspeaker

Board Regular
Joined
Jan 10, 2019
Messages
70
Here is my problem:

I’m trying to create a macro to find & replace certainrows of text in an Excel worksheet.


Example:

5710
Electric in Pasture (CLAIM 100%)
0.00
Dr
<tbody> </tbody>
Replace with:
5710
Electric in Pasture (CLAIM 100%)
0.00
Dr
<tbody> </tbody>


5720
Electric in Yard (represents 66.6%)
0.00
Dr
<tbody> </tbody>
Replace with:
5720
Electric in Yard (figures represent 66.6%)
0.00
Dr
<tbody> </tbody>


5940
Telephone / Landline (rep. 33.3%)
0.00
Dr
<tbody> </tbody>
Replace with:
5940
Telephone / Landline (figures represent 33.3%)
0.00
Dr
<tbody> </tbody>


Many thanks in advance,

Jerry


 

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
Assume A1 is original text,

C1=SUBSTITUTE(SUBSTITUTE(A1,"(represents","(figures represent "),"(rep.","(figures represent ") copy down
 
Upvote 0
Here is a better representation of my spreadsheet:


A
B
C
D
E
F



XXXXXXXXXX 2017





Transactions by Account Report 01/01/2017 to 31/12/2017




Sorted by: Date
















Date
Comment
Source #
Debits
Credits
Balance










5710
Electric in Pasture (CLAIM 100%) REPLACE WITH: “Electric in Pasture (CLAIM 100%)
0.00
Dr


18/01/2017
electric SW 30-21-5-4 pasture (CLAIM 100%)
ATCO Electric
36.22
0.00
36.22
Dr


15/02/2017
electric SW 30-21-5-4 pasture (CLAIM 100%)
ATCO Electric
30.73
0.00
66.95
Dr


17/03/2017
electric SW 30-21-5-4 pasture (CLAIM 100%)
ATCO Electric
32.92
0.00
99.87
Dr
5720
Electric in Yard (represents 66.6%) REPLACE WITH: “Electric in Yard (figures represent 66.6%)
0.00
Dr


20/01/2017
electric SW 28-21-5-4 including house (figures represent 66.6%)
Direct Energy
101.10
0.00
101.10
Dr


17/02/2017
electric SW 28-21-5-4 including house (figures represent 66.6%)
Direct Energy
123.74
0.00
224.84
Dr



21/03/2017
electric SW 28-21-5-4 including house (figures represent 66.6%)
Direct Energy
110.91
0.00
335.75
Dr









5860
Natural Gas (represents 50%) REPLACE WITH: “Natural Gas (figures represent 50%)
0.00
Dr


10/01/2017
gas utilities including house (figures represent 50%)

Dry Country Gas
152.27
0.00
152.27
Dr


08/02/2017
gas utilities including house (figures represent 50%)
Dry Country Gas
124.55
0.00
276.82
Dr



07/03/2017
gas utilities including house (figures represent 50%)
Dry Country Gas
57.28
0.00
334.10
Dr

<tbody> </tbody>
 
Upvote 0
Just a suggestion since I'm attempting to REPLACE only certain specific text, would the solution include making a LIST of the specific text I want to replace?
 
Upvote 0
Further to my question:

There are only 3 strings of text that need replacing in each worksheet:


  • “Electric in Pasture (CLAIM 100%)” TO “Electric in Pasture (CLAIM 100%)
  • “Electric in Yard (represents 66.6%)” TO “Electric in Yard (figures represent 66.6%)
  • “Natural Gas (represents 50%)” TO “Natural Gas (figures represent 50%)

Many thanks,

Jerry
 
Last edited:
Upvote 0

Forum statistics

Threads
1,215,059
Messages
6,122,917
Members
449,093
Latest member
dbomb1414

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