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

NVRensburg

Board Regular
Joined
Jul 1, 2014
Messages
88
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?
 

Excel Facts

Format cells as time
Select range and press Ctrl+Shift+2 to format cells as time. (Shift 2 is the @ sign).

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
73,434
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
18,714
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
 
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,164,601
Messages
5,838,300
Members
430,537
Latest member
Antonio11

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top