Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Copy into Row holding Button

On my worksheet I have a button that inserts a copied row from anothe
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
would like the macro to insert the row on the same line as the butto
was when pressed.

Presumably I need to get the macro to select the row relative to th
button that operates it?

Any ideas?

One other issue might be that the button is itself copied several time
and so exists several times on the same sheet. Perhaps a bette
explanation is to explain what the sheet does. It is a Risk register t
record project risks. There exists a macro to add a new risk (which i
two rows of data, the second being a row with a mitigation option), a
well as the two rows of data it also copies the button as describe
above. This button activates the macro printed above and insert
another mitigation option. Dont know if this paragraph helps if no
please disregard

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

  #2   Report Post  
Posted to microsoft.public.excel.programming
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/

.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Copy into Row holding Button

Thanks, but that means that the row is always inserted on row 11. I wan
it to insert on the same row as the button was when pressed, regardles
of where that button was positioned because it will move down as row
are inserted.

i.e. perhaps something like myrowtouse = the same row the button i
when pressed.

Is there anyway of doing this?

Nejl





GJones wrote:
[b]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,

Gre


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

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
Indirect formulas in cells not holding cell format after copy Cathy[_3_] Excel Worksheet Functions 3 March 21st 10 05:39 AM
holding the result constant [email protected] Excel Worksheet Functions 1 July 14th 06 11:46 PM
holding a value after first calcuation spence Excel Worksheet Functions 2 March 27th 06 12:54 AM
Delete a custom button by holding down the ALT key and dragging the button off the toolbar Stephen[_8_] Excel Programming 0 April 4th 04 02:22 PM
#Holding values in different format# Dean Knox[_2_] Excel Programming 2 November 26th 03 02:36 PM


All times are GMT +1. The time now is 05:06 AM.

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"