Repeat Button

Discussion in 'Excel Programming' started by Steved, Oct 22, 2007.

  1. Steved

    Steved 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.
     
    Steved, Oct 22, 2007
    #1
    1. Advertisements

  2. > 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
     
    Rick Rothstein \(MVP - VB\), Oct 22, 2007
    #2
    1. Advertisements

  3. Steved

    Steved Guest

    Hello Rick from Steved

    Thankyou very much.

    "Rick Rothstein (MVP - VB)" wrote:

    > > 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
    >
    >
     
    Steved, Oct 22, 2007
    #3
  4. Steved

    uchiha Guest

    Steved wrote on 10/22/2007 16:36 ET
    > ursoHello from Steve
    >
    > Ok please using the below I want to create a Repeat Button to bev put in th
    > excel ribbon ( Using Excel 2007 Version
    >
    > Very simple put if I put the cusor in any cell I want it to copy the Abov
    > Cell for example I'm in say Cell K202 I want to copy the cell contents of
    > Cell K201 and paste the contents into Cell K20
    >
    > Sub Repeat(
    > Range("H30").Selec
    > Selection.Cop
    > Range("H31").Selec
    > ActiveSheet.Past
    > End Su
    >
    > Thankyou
    >

    It is very rare for me to see questions towards repeat button. This is a goo
    question

    Actually repeat button is not frequently used among all the button controls

    http://www.kettic.com/winforms_ui/buttons_overview.shtm

    Here I found some detailed materials about the repeat button, hope it can b
    useful to your situation

    http://www.kettic.com/winforms_ui/csharp_guide/buttons_repeatbutton.shtml
     
    uchiha, Apr 22, 2014
    #4
    1. Advertisements

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. John

    Undo, Redo, Repeat and Validation

    John, Jul 8, 2003, in forum: Excel Programming
    Replies:
    0
    Views:
    113
  2. Huyeote

    Repeat importing text

    Huyeote, Jul 23, 2003, in forum: Excel Programming
    Replies:
    1
    Views:
    67
  3. Joe Wooldridge

    Simply was to repeat a macro N times

    Joe Wooldridge, Jul 25, 2003, in forum: Excel Programming
    Replies:
    2
    Views:
    94
    Myrna Larson
    Jul 25, 2003
  4. Milind

    How to repeat code for 11 files?

    Milind, Aug 6, 2003, in forum: Excel Programming
    Replies:
    0
    Views:
    75
    Milind
    Aug 6, 2003
  5. Phil Hageman

    Button, Button, which Button?

    Phil Hageman, Nov 4, 2003, in forum: Excel Programming
    Replies:
    4
    Views:
    208
    Phil Hageman
    Nov 4, 2003
  6. bilbo+

    repeat row button

    bilbo+, Jul 11, 2007, in forum: Excel Programming
    Replies:
    0
    Views:
    55
    bilbo+
    Jul 11, 2007
  7. marita
    Replies:
    3
    Views:
    337
    Bob Phillips
    Jul 18, 2008
  8. Jeanette

    Help to repeat find on button click

    Jeanette, Jul 4, 2009, in forum: Excel Programming
    Replies:
    2
    Views:
    171
    Patrick Molloy
    Jul 4, 2009
Loading...