ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Help with copying a range by selecting a cell. (https://www.excelbanter.com/excel-programming/360934-help-copying-range-selecting-cell.html)

Kezza

Help with copying a range by selecting a cell.
 
Hi to all, new at this.
I am wanting to copy a range in a row from one worksheet to another by
selecting the cell in "A" eg.:
by clicking on a cell in worksheet 1 "A?", I can copy range A to F in
that row to worksheet 2 in the next available row.
please help
Thanks
Kezza


Harald Staff

Help with copying a range by selecting a cell.
 
Hi Kezza

Sub copyRow()
Dim R As Range
On Error Resume Next
Set R = Application.InputBox("Click A cell:", _
"Will copy this row", Type:=8)
If R Is Nothing Then Exit Sub
On Error GoTo 0
Set R = R.Resize(1, 5)
R.copy Sheets(2).Cells(65000, 1).End(xlUp).Offset(1, 0)
End Sub

HTH. Best wishes Harald

"Kezza" skrev i melding
oups.com...
Hi to all, new at this.
I am wanting to copy a range in a row from one worksheet to another by
selecting the cell in "A" eg.:
by clicking on a cell in worksheet 1 "A?", I can copy range A to F in
that row to worksheet 2 in the next available row.
please help
Thanks
Kezza





All times are GMT +1. The time now is 07:03 AM.

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