VBA loop that finds a text string, delete a range and setup a clean dataset

MRDecarte

New Member
Joined
May 24, 2014
Messages
20
Hello everyone,

I am not familiar with VBA but I look for a code that can help me to set up a report.
Basically, the code should find the word "Conf" and delete the range including the row containing the text string and 6 rows below etc..in a loop

Range("A2").Select
Cells.Find(What:="conf", After:=ActiveCell, LookIn:=xlFormulas, LookAt _
:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:= _
False, SearchFormat:=False).Activate
Rows("59:65").Select
Selection.Delete Shift:=xlUp

Then because I copy the data from a pdf I have some numbers or text in column A that should be cut and pasted in the last column of the above line. Likewise some numbers or text different from 2018 in Column A & B that should be cut and pasted in the last column above the line. So every time the expression i a line is different from "2018" than the number and text string should be pasted in the last column above.
A B

<tbody>
</tbody>

2018190712
2018190712

<colgroup><col width="64" span="3" style="width:48pt"> </colgroup><tbody>
</tbody>
10006723 15392.64

<tbody>
</tbody>



<tbody>
</tbody>
I hope it is clear enough and thank you for the help much appreciated,

best regards
MRDecarte
 

Excel Facts

Formula for Yesterday
Name Manager, New Name. Yesterday =TODAY()-1. OK. Then, use =YESTERDAY in any cell. Tomorrow could be =TODAY()+1.

Forum statistics

Threads
1,214,585
Messages
6,120,394
Members
448,957
Latest member
Hat4Life

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