cut and paste x spaces below where x=value(b7)

kingdomb

New Member
Joined
May 17, 2011
Messages
16
I have a spread sheet with the text "Medics" somewhere in the A column but not always in the same place. I have a number in cell b7. I want to find the word "Medic", select that cell, the cell in the B column next to it and everything below these two cells (no farther than 99) and move them down the number of rows referenced in b7. So pretend I have the '4' in b7, and the word "medic" is in A16. I want to Cut A16:B99 and paste it 4 rows below into A20. thanks
 

Excel Facts

Round to nearest half hour?
Use =MROUND(A2,"0:30") to round to nearest half hour. Use =CEILING(A2,"0:30") to round to next half hour.
Try this code...

Sub movestuff()
x = Application.WorksheetFunction.Match("medic", Range("a:a"), 0)
y = Range("b7").Value
Range("a" & x & ":b" & x + 99).Cut Range("a" & x + y)
End Sub

Jerry
 
Upvote 0

Forum statistics

Threads
1,224,548
Messages
6,179,448
Members
452,915
Latest member
hannnahheileen

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