PC Review


Reply
Thread Tools Rate Thread

How to clear a row I have selected to copy to another worksheet

 
 
Kezza
Guest
Posts: n/a
 
      18th Mar 2008
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
 
Reply With Quote
 
 
 
 
Otto Moehrbach
Guest
Posts: n/a
 
      18th Mar 2008
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" <(E-Mail Removed)> wrote in message
news:e280b7c0-ae89-4f41-a8ff-(E-Mail Removed)...
> 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



 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to copy an Excel worksheet with formulas and clear contents. Compeer buddy Microsoft Excel Misc 2 29th Jan 2008 05:21 PM
How to use VBA to copy selected data from one worksheet to another =?Utf-8?B?ZGh1bnRlcjQz?= Microsoft Excel Programming 2 13th Aug 2007 03:20 PM
copy selected rows to a new worksheet =?Utf-8?B?RGF2aWQgR2Vyc3RtYW4=?= Microsoft Excel Programming 2 5th Feb 2007 04:01 PM
Is it possible to copy only selected items to another worksheet... =?Utf-8?B?SEVBVEhFUkNPWA==?= Microsoft Excel Worksheet Functions 2 1st Mar 2005 01:21 PM
Copy selected rows into another worksheet =?Utf-8?B?ZFNi?= Microsoft Excel Misc 3 16th Dec 2003 01:26 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:37 PM.