Link to home
Start Free TrialLog in
Avatar of rcjax
rcjaxFlag for United States of America

asked on

How to write a VB script in Excel to copy from a cell range and paste to another while inserting a new row?

I am trying to write a VB script that I can assign to a button on a Excel workbook. What I need the script to do is copy a cell range (i.e., a10:l10) and paste it to another area in the same spreadsheet. I also need to clear the copied cells and cause the spreadsheet where I paste the data to automatically insert a new row.  This is for an Excel spreadsheet using Microsoft VB.
ASKER CERTIFIED SOLUTION
Avatar of jsemenak
jsemenak

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Try this: (done with the macro recorder)

    Range("A1:C1").Select
    Selection.Copy
    Range("A5").Select
    Selection.Insert Shift:=xlDown
    Range("A1:C1").Delete

This actually does not insert a whole row but move the cells down for the range with only.
It should more or less do what you seek?
lol, 1 min too late :)