ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How to clear a row I have selected to copy to another worksheet (https://www.excelbanter.com/excel-programming/407869-how-clear-row-i-have-selected-copy-another-worksheet.html)

Kezza

How to clear a row I have selected to copy to another worksheet
 
Hello all, I am trying to clear a row after it has been selected to be
copied to another worksheet. The code I have currently copies and
pastes well but I still have to manually highlight and "clear
contents" to remove it. I'm sure for you guys that this is probably so
simple. Hope you can help. Here is the Copy/Paste code I have.

Sub Button153_Click()
Dim R As Range
On Error Resume Next
Set R = Application.InputBox("Select A Row to Copy:", _
"Transfer to Complete", Type:=8)
If R Is Nothing Then Exit Sub
On Error GoTo 0
Set R = R.Resize(1, 8)
R.Copy Sheets(2).Cells(65000, 1).End(xlUp).Offset(1, 0)
Sheets("Complete").Select
Sheets("Outstanding").Select
End Sub


Thanks

Otto Moehrbach[_2_]

How to clear a row I have selected to copy to another worksheet
 
If you want to clear R, use:
R.ClearContents
If you want to clear the entire row as you say, use:
R(1).EntireRow.ClearContents
HTH Otto
"Kezza" wrote in message
...
Hello all, I am trying to clear a row after it has been selected to be
copied to another worksheet. The code I have currently copies and
pastes well but I still have to manually highlight and "clear
contents" to remove it. I'm sure for you guys that this is probably so
simple. Hope you can help. Here is the Copy/Paste code I have.

Sub Button153_Click()
Dim R As Range
On Error Resume Next
Set R = Application.InputBox("Select A Row to Copy:", _
"Transfer to Complete", Type:=8)
If R Is Nothing Then Exit Sub
On Error GoTo 0
Set R = R.Resize(1, 8)
R.Copy Sheets(2).Cells(65000, 1).End(xlUp).Offset(1, 0)
Sheets("Complete").Select
Sheets("Outstanding").Select
End Sub


Thanks





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

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