Cut,clear and replace.

topi1

Active Member
Joined
Aug 6, 2014
Messages
252
Office Version
  1. 2010
Hi,
I am hoping to get a vba for the following.
In sheet2, column R, loop through cells and look for cells which start with "GHT:" (not case sensitive).
If it finds two cells that begin with "GHT:", cut and clear the bottom one and paste replace the top one.

Not critical but it will be nice if GHT can be all CAP after cell has been pasted, regardless of how the bottom cell originally was.

The number of preceding, intervening and subsequent rows vary.
"GHT:" could be in the first row although unlikely.
No blanks.
Thank you.

Here is the example.

BEFORE
Only necessary VBA 11.xlsm
R
11
22
33
4GHT: 1
54
65
76
8Ght: 2
97
Sheet2


AFTER
Only necessary VBA 11.xlsm
R
11
22
33
4GHT: 2
54
65
76
8
97
Sheet2
 
It should not have made any difference. Just need to start in the range of cells you want to transform.
But, what you have done is taken out the concern of a current range larger than one column, so that is good.

But, if you are satisified, I'm happy you were able to get to a solution.

Best Wishes.
 
Upvote 0

Excel Facts

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.

Forum statistics

Threads
1,223,907
Messages
6,175,301
Members
452,633
Latest member
DougMo

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