#1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 109
Default 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   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2,646
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Cannot insert worksheet in exel - not available in insert menu pedro39 Excel Worksheet Functions 1 July 24th 08 12:09 PM
insert row / insert column command buttons fairgreen Excel Worksheet Functions 1 October 29th 07 02:41 PM
How can I insert a date with an icon (calendar) insert Alfredo Mederico[_2_] Excel Discussion (Misc queries) 4 September 21st 07 01:20 AM
Can I auto insert a worksheet when I insert a value in a cell. iainc Excel Worksheet Functions 0 April 27th 06 08:37 AM
Insert Next? Or insert a variable number of records...how? Tom MacKay Excel Discussion (Misc queries) 0 April 20th 06 10:44 PM


All times are GMT +1. The time now is 03:22 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"