Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.misc
|
|||
|
|||
How do I create a macro to duplicate the current row?
I want to create a macro that will insert a blank row beneath the current row
and will then copy the contents of the current row to the inserted row. I can do the operation manually but when I record it as a macro then run the macro it is not quite right. It works fine if I want to add just one new row. However, when I need run the macro to add further rows the macro always returns me to the point (row) where the I ran it for the first time. Does anyone know what I need to put into the macro, when editing it, to stop this happening? |
#2
Posted to microsoft.public.excel.misc
|
|||
|
|||
How do I create a macro to duplicate the current row?
Hi
As always post your macro for comments. Look at this and see if it is what you need: Sub InsertRowBelow() ActiveCell.Offset(1, 0).EntireRow.Insert ActiveCell.EntireRow.Copy Range("A" & ActiveCell.Row + 1) End Sub Regards, Per "lorenzo" skrev i meddelelsen ... I want to create a macro that will insert a blank row beneath the current row and will then copy the contents of the current row to the inserted row. I can do the operation manually but when I record it as a macro then run the macro it is not quite right. It works fine if I want to add just one new row. However, when I need run the macro to add further rows the macro always returns me to the point (row) where the I ran it for the first time. Does anyone know what I need to put into the macro, when editing it, to stop this happening? |
#3
Posted to microsoft.public.excel.misc
|
|||
|
|||
How do I create a macro to duplicate the current row?
This macro duplicates the row of the active cell:
Sub test() Cells(ActiveCell.Row + 1, ActiveCell.Column).EntireRow.Insert Shift:=xlDown ActiveCell.EntireRow.Copy Destination:=Cells(ActiveCell.Row + 1, ActiveCell.Column).EntireRow End Sub Regards, Stefi €žlorenzo€ť ezt Ă*rta: I want to create a macro that will insert a blank row beneath the current row and will then copy the contents of the current row to the inserted row. I can do the operation manually but when I record it as a macro then run the macro it is not quite right. It works fine if I want to add just one new row. However, when I need run the macro to add further rows the macro always returns me to the point (row) where the I ran it for the first time. Does anyone know what I need to put into the macro, when editing it, to stop this happening? |
#4
Posted to microsoft.public.excel.misc
|
|||
|
|||
How do I create a macro to duplicate the current row?
Sub insertsamelinerow()
Rows(ActiveCell.Row).Copy Rows(ActiveCell.Row + 1).Insert Application.CutCopyMode = False End Sub -- Don Guillett Microsoft MVP Excel SalesAid Software "lorenzo" wrote in message ... I want to create a macro that will insert a blank row beneath the current row and will then copy the contents of the current row to the inserted row. I can do the operation manually but when I record it as a macro then run the macro it is not quite right. It works fine if I want to add just one new row. However, when I need run the macro to add further rows the macro always returns me to the point (row) where the I ran it for the first time. Does anyone know what I need to put into the macro, when editing it, to stop this happening? |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
create a spreadsheet that would insert a current date() when opene | Excel Worksheet Functions | |||
How do I create a chart that will show 4 weeks of current info? | Charts and Charting in Excel | |||
Create buttom that saves current file in a given filename (Excel) | Excel Worksheet Functions | |||
Button/Script to create a new workbook from a current one. | Excel Worksheet Functions | |||
How do I create a mailing list with current data in Excel? | Excel Discussion (Misc queries) |