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

Copy PDF to Excel
Select data in PDF. Paste to Microsoft Word. Copy from Word and paste to Excel.

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
46,541
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,867
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,109,383
Messages
5,528,377
Members
409,817
Latest member
JiNXX9500

This Week's Hot Topics

  • Change military grades into rank
    Afternoon all Need help with formula that will change military rank (i.e. 1, 2, 3 into Amn, A1C, SrA). Running IF formula that does not work...
  • VBA COUNTIF SOLUTION
    Hi The following are the errors spread across the several columns from E to Q ie. 13 columns across several sheets with more than 500 rows per...
  • INSERT ROW WITH SPECIFIS TEXT IN A COLUMN
    Hi All! How can identify that that the row to be inserted has to be inserted before 1st row with specific text in column F. If I record the...
  • Auto-Create a monthly Sign in sheet for preschool students
    The image below is what each page looks like. Above is space for the "Child Name" "Month" "Class" School days are obviously Monday-Friday but...
  • VBA vlookup multiple results
    Hi folks, Hopefully someone out there can help. I have a list to vlookup which works (ish). the lookup only picks up the first instance of the...
  • Extract values for earliest/latest times
    I am trying to put together a formula to get the earliest start time, the latest end time from column A for each person in Column B-F without the...
Top