Repeat Button

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

ursoHello from Steved

Ok please using the below I want to create a Repeat Button to bev put in the
excel ribbon ( Using Excel 2007 Version )

Very simple put if I put the cusor in any cell I want it to copy the Above
Cell for example I'm in say Cell K202 I want to copy the cell contents off
Cell K201 and paste the contents into Cell K202

Sub Repeat()
Range("H30").Select
Selection.Copy
Range("H31").Select
ActiveSheet.Paste
End Sub

Thankyou.
 
Ok please using the below I want to create a Repeat Button to bev put in
the
excel ribbon ( Using Excel 2007 Version )

Very simple put if I put the cusor in any cell I want it to copy the Above
Cell for example I'm in say Cell K202 I want to copy the cell contents off
Cell K201 and paste the contents into Cell K202

Sub Repeat()
Range("H30").Select
Selection.Copy
Range("H31").Select
ActiveSheet.Paste
End Sub

First off, I would rewrite that subroutine to get rid of all that Selecting,
Copying and Pasting. Give this a try...

Sub Repeat()
If ActiveCell.Row > 1 Then ActiveCell.Value = ActiveCell.Offset(-1, 0)
End Sub

Okay, I'm not too familiar with Excel 2007, but a fast look made it seem
like User Macros can be added quite easily to the Quick Access Toolbar (QAT
for short). After creating the macro above, right-click the QAT and select
Customize Quick Access Toolbar. Under the "Choose commands from" drop down,
select Macros from the list (4th item down on my system), click the name of
the macro in the list and then click the Add button. Next, click the Modify
button and choose an icon to your liking. Finally, click OK to return to the
spreadsheet. Select a cell on the spreadsheet, click your icon that was just
added to the QAT and the selected cell will be assigned the contents of the
cell immediately above it.

Rick
 
Hello Rick from Steved

Thankyou very much.

Rick Rothstein (MVP - VB) said:
First off, I would rewrite that subroutine to get rid of all that Selecting,
Copying and Pasting. Give this a try...

Sub Repeat()
If ActiveCell.Row > 1 Then ActiveCell.Value = ActiveCell.Offset(-1, 0)
End Sub

Okay, I'm not too familiar with Excel 2007, but a fast look made it seem
like User Macros can be added quite easily to the Quick Access Toolbar (QAT
for short). After creating the macro above, right-click the QAT and select
Customize Quick Access Toolbar. Under the "Choose commands from" drop down,
select Macros from the list (4th item down on my system), click the name of
the macro in the list and then click the Add button. Next, click the Modify
button and choose an icon to your liking. Finally, click OK to return to the
spreadsheet. Select a cell on the spreadsheet, click your icon that was just
added to the QAT and the selected cell will be assigned the contents of the
cell immediately above it.

Rick
 
Back
Top