Home |
Search |
Today's Posts |
|
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
I want to create a "Insert Row" button to insert a new row at the.
I want to create a "Insert new row" button to insert new rows at the bottom
of my table that contains the same functions as previous rows... |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
I want to create a "Insert Row" button to insert a new row at the.
Assuming your data starts in Cell A1, your button could run the code:
Sub NewRow() Application.ScreenUpdating = False Dim lastRow As Long Dim lastCol As Long Dim startrng As Range Set startrng = ActiveCell lastRow = Cells(Rows.Count, "A").End(xlUp).Row lastCol = Cells("1", Columns.Count).End(xlToLeft).Column Range(Cells(lastRow, 1), Cells(lastRow, lastCol)).Copy Range(Cells(lastRow + 1, 1), Cells(lastRow + 1, lastCol)) _ .PasteSpecial Paste:=xlPasteFormulas Range(Cells(lastRow + 1, 1), Cells(lastRow + 1, lastCol)) _ .PasteSpecial Paste:=xlPasteFormats On Error Resume Next Range(Cells(lastRow + 1, 1), Cells(lastRow + 1, lastCol)) _ .SpecialCells(xlCellTypeConstants).ClearContents Application.Goto startrng Application.CutCopyMode = False Application.ScreenUpdating = True End Sub Regards Rowan "Georges" wrote: I want to create a "Insert new row" button to insert new rows at the bottom of my table that contains the same functions as previous rows... |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
insert objects in .xlsx fails with message "cannot insert object" | Excel Discussion (Misc queries) | |||
Lost "File Menu" - now it's "Edit / View / Insert.." but no "F | Excel Discussion (Misc queries) | |||
Insert "SAVE" Button in Excel | Excel Worksheet Functions | |||
Insert "-" in text "1234567890" to have a output like this"123-456-7890" | Excel Discussion (Misc queries) | |||
"cannot insert object" in Excel (even a button from Control Toolbox) | Excel Programming |