Button next to each item in price list to copy row over

NVRensburg

Board Regular
Joined
Jul 1, 2014
Messages
68
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
Hi my fave excel helpers :)

I have an excel spreadsheet which is a price list. There are about 1200 pages in it so what I want to do is add a button next to each row that when I go through the list and I find what I want, I want to click the button next to the item and it will add it to my quote sheet which will be a separate sheet in the workbook. Does anyone know how to do this?
 

Some videos you may like

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
48,023
Office Version
  1. 365
Platform
  1. Windows
Hi
Put something like this in the buttoncode, changing the destination range to suit
Code:
Private Sub CommandButton1_Click()

    Rows(2).Copy Destination:=Sheets("Quote").Range("A" & Rows.Count).End(xlUp).Offset(1, 0)

End Sub
Also changing the Row number for each button
 

My Aswer Is This

Well-known Member
Joined
Jul 5, 2014
Messages
16,986
Office Version
  1. 2013
Platform
  1. Windows
Try This:</SPAN>
Right Click on your sheet tab</SPAN>
Choose View code</SPAN>
Paste the below code:</SPAN>
Now any time you select a cell in column "A" your script will copy that row into "Sheet2"</SPAN>
To insure this action only happens when you want it. You must enter "Yes" into cell "B1"</SPAN>
Just once before you start the script.
You can modify the script if necessary</SPAN>
For example change sheet name or "Yes" can be put in some other cell.</SPAN>
This will keep you from making 2,000 buttons.</SPAN>
Code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Column = 1 Then
If Range("B1") = "Yes" Then
Rows(ActiveCell.Row).Copy Destination:=Sheets("Sheet2").Range("A" & Rows.Count).End(xlUp).Offset(1, 0)
End If
End If
End Sub
 

Watch MrExcel Video

Forum statistics

Threads
1,113,824
Messages
5,544,541
Members
410,619
Latest member
gregor222
Top