View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
GJones GJones is offline
external usenet poster
 
Posts: 132
Default Copy into Row holding Button


Hi nejlangton;



Sub NEWRMO2()
'
' NEWRMO Macro
' Macro recorded 02/09/2004 by charles
'

'
Sheets("Template").Select
MyRowToUse = 11
Rows("11:11").EntireRow.Copy
Sheets("Risk Register").Select
Cells(MyRowToUse, 1).Select
ActiveCell.Offset(0, 0).Rows("1:1").EntireRow.Select
Selection.Insert Shift:=xlDown
End Sub

Thanks,

Greg

-----Original Message-----
On my worksheet I have a button that inserts a copied row

from another
sheet when pressed. The code is as follows:

Sub NEWRMO()
'
' NEWRMO Macro
' Macro recorded 02/09/2004 by charles
'

'
Sheets("Template").Select
Rows("11:11").EntireRow.Copy
Sheets("Risk Register").Select
ActiveCell.Offset(0, 0).Rows("1:1").EntireRow.Select
Selection.Insert Shift:=xlDown
End Sub


At present the row is pasted wherever the active cell is,

however I
would like the macro to insert the row on the same line

as the button
was when pressed.

Presumably I need to get the macro to select the row

relative to the
button that operates it?

Any ideas?

One other issue might be that the button is itself copied

several times
and so exists several times on the same sheet. Perhaps a

better
explanation is to explain what the sheet does. It is a

Risk register to
record project risks. There exists a macro to add a new

risk (which is
two rows of data, the second being a row with a

mitigation option), as
well as the two rows of data it also copies the button as

described
above. This button activates the macro printed above and

inserts
another mitigation option. Dont know if this paragraph

helps if not
please disregard!


---
Message posted from http://www.ExcelForum.com/

.