ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   custom button to copy a few cells and paste on somwhere else (https://www.excelbanter.com/excel-programming/363656-custom-button-copy-few-cells-paste-somwhere-else.html)

Omid

custom button to copy a few cells and paste on somwhere else
 
How can i build a custom button to copy a few specific cells (B3:E2) and
paste them to a list (MY LIST) in another worksheet(REPORT SHEET)?

ADG

custom button to copy a few cells and paste on somwhere else
 
Hi OMID

I assume you want to add the items at the end of the data on the Report
Sheet. Draw a button on the sheet with the data then add the code below
(modify as necessary).

Private Sub CommandButton1_Click()
Dim lngRow As Long
Dim R As Range

Set R = ActiveSheet.Range("B2:E5")
With Worksheets("Report Sheet")
lngLastRow = Cells.SpecialCells(xlCellTypeLastCell).Row
.Range(.Cells(lngLastRow + 1, 2), .Cells(lngLastRow + 2, 5)).Value =
R.Value
End With

End Sub

--
Tony Green


"OMID" wrote:

How can i build a custom button to copy a few specific cells (B3:E2) and
paste them to a list (MY LIST) in another worksheet(REPORT SHEET)?



All times are GMT +1. The time now is 05:58 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com