Public Schedule Face-to-Face & Online Instructor-Led Training - View dates & book

find cell then cut

Forum home » Delegate support and help forum » Microsoft Excel VBA Training and help » Find Cell then Cut Rows

Find Cell then Cut Rows

ResolvedVersion 2010

Mark has attended:
Excel VBA Intro Intermediate course
Excel Advanced - For Power Users course
Excel PowerPivot course
Excel Dashboards for Business Intelligence course

Find Cell then Cut Rows

Hi,

I'm trying to write some code where I need to find a cell that contains "M002" and then cuts the first row that it appears in through to the next 30 rows.

The difficulty I'm having is that I only want to search for M002 in column A as it appears elsewhere in the document.

My plan was to insert a MATCH formula into the document to find where in the list M002 appears and then to count the rows down from the cell with the MATCH formula before selecting 35 rows and cutting.

Any help is appreciated.

Mark

RE: Find Cell then Cut Rows

Hi Mark,

Thank you for the forum question.

Please have a look at my code below. I hope this is what you need.

Sub CutRows()

Range("a:a").Find(what:="M002").Select
Selection.Range(Rows(1), Rows(30)).Cut

End Sub


Kind regards

Jens Bonde
Microsoft Office Specialist Trainer

Tel: 0207 987 3777
Best STL - https://www.stl-training.co.uk
98%+ recommend us

London's leader with UK wide delivery in Microsoft Office training and management training to global brands, FTSE 100, SME's and the public sector

 

Training courses

Training information:

Welcome. Please choose your application (eg. Excel) and then post your question.

Our Microsoft Qualified trainers will then respond within 24 hours (working days).

Frequently Asked Questions
What does 'Resolved' mean?

Any suggestions, questions or comments? Please post in the Improve the forum thread.

Excel tip:

Naming and Using Constants

Constants make calculations easier so worksheets are more easily understood. Constant values also need to be given relevant and memorably names. It is also easier to change the value of a constant.

For example:
Instead of entering 17.5% in each cell when you generate a VAT amount you could name a Constant "VAT" and assigning a "0.175" value to it. To do this:

From the 'Insert' menu select 'Name', then select 'Define'.

Enter the constant

View all Excel hints and tips

Connect with us:

0207 987 3777

Call for assistance

Request Callback

We will call you back

Server loaded in 0.11 secs.