Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.misc
|
|||
|
|||
Insert New Row
Good morning,
The following recorded code copies row 1 inserts it at row 10 andthen selects cell A10. How would it be adapted such that the user would be prompted as to above which row they would like to insert the copied row? e.g. macro copies row 1, prompt user "above which row would you like to enter the copied row?", copy row to selected place, select cell in column A of new row. Sub INSERT_NEW_ROW() ' ' INSERT_NEW_ROW Macro ' Macro recorded 23/07/2009 by Gleeds ' ' Rows("1:1").Select Selection.Copy Rows("10:10").Select Selection.Insert Shift:=xlDown Application.CutCopyMode = False Range("A10").Select End Sub Your in appreciation, Neil |
#2
Posted to microsoft.public.excel.misc
|
|||
|
|||
Insert New Row
Try this:
Sub INSERT_NEW_ROW() ' ' INSERT_NEW_ROW Macro ' Macro recorded 23/07/2009 by Gleeds ' ' Rows("1:1").Select Selection.Copy insrow = InputBox("Enter row No you want to insert above!") insrownum = Val(insrow) If insrownum = 0 Then Application.CutCopyMode = False MsgBox "This is not a number!" Exit Sub End If Rows(insrow).Select Selection.Insert Shift:=xlDown Application.CutCopyMode = False Range("A10").Select End Sub Regards, Stefi €˛Neil Pearce€¯ ezt Ć*rta: Good morning, The following recorded code copies row 1 inserts it at row 10 andthen selects cell A10. How would it be adapted such that the user would be prompted as to above which row they would like to insert the copied row? e.g. macro copies row 1, prompt user "above which row would you like to enter the copied row?", copy row to selected place, select cell in column A of new row. Sub INSERT_NEW_ROW() ' ' INSERT_NEW_ROW Macro ' Macro recorded 23/07/2009 by Gleeds ' ' Rows("1:1").Select Selection.Copy Rows("10:10").Select Selection.Insert Shift:=xlDown Application.CutCopyMode = False Range("A10").Select End Sub Your in appreciation, Neil |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Cannot insert worksheet in exel - not available in insert menu | Excel Worksheet Functions | |||
insert row / insert column command buttons | Excel Worksheet Functions | |||
How can I insert a date with an icon (calendar) insert | Excel Discussion (Misc queries) | |||
Can I auto insert a worksheet when I insert a value in a cell. | Excel Worksheet Functions | |||
Insert Next? Or insert a variable number of records...how? | Excel Discussion (Misc queries) |