Get Row, Cut and Insert

I recorded this and it uses row 11.  How do I do the samething but only on the row of the ActiveCell?  and make sure that only one cell is selected and not a range of rows?

    Selection.Insert Shift:=xlDown

Open in new window

Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

When you say "do the same thing" do you mean cut from the active cell and then insert the cell into B7 and shift down? Is this what you're trying to do?

    ActiveCell.Insert xlShiftDown

Open in new window

RWayneHAuthor Commented:
No cut the whole row of the activecell, not the cell only.  So if in active cell is h23.  Cut row 23 and insert it at row 7 (move it to the top), shifting it all down.
Ok. Try this.


Open in new window

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Python 3 Fundamentals

This course will teach participants about installing and configuring Python, syntax, importing, statements, types, strings, booleans, files, lists, tuples, comprehensions, functions, and classes.

RWayneHAuthor Commented:
How about if I wanted to paste it into row 7 instead of inserting it?   .Paste did not work.
Okay, that's a new question : )

Did the code in my previous comment answer this question?

"No cut the whole row of the activecell, not the cell only.  So if in active cell is h23.  Cut row 23 and insert it at row 7 (move it to the top), shifting it all down. "

For the pasting question, do you want to delete the row that you want to  paste in row 7?
RWayneHAuthor Commented:
Yes delete the old row.  Just moving the row to the top of the list.  A different procedure happens to add a blank row at the top of the list.  Yes suppose it is another simular question.
Saurabh Singh TeotiaCommented:

Here are two methods to do the same..


Sub mverws()
ActiveCell.EntireRow.Copy Range("a7")

End Sub

Open in new window


Sub mverws1()


End Sub

Open in new window

Ok, the following will address your second request. Note that this will affect only the current region which means that if you have information on the same row but to the right of your table and not related to that table, that information will not be deleted.

Sub CopyRws()

Dim rng As Range
Dim intCols As Integer
Dim introw As Integer

Set rng = ActiveCell.CurrentRegion
intCols = rng.Columns.Count
introw = ActiveCell.Row

Range(Cells(introw, 1), Cells(introw, intCols)).Copy

Range("A7").PasteSpecial xlPasteAll

Range(Cells(introw, 1), Cells(introw, intCols)).Delete xlShiftUp

Set rng = Nothing

End Sub

Open in new window

RWayneHAuthor Commented:
Split the points, both great solutions..  sorry for the delay in responding.  Appreciate the help.
Great! Always glad to help. Thanks for the points!
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Excel

From novice to tech pro — start learning today.