PC Review


Reply
Thread Tools Rate Thread

How to Copy from one sheet and paste into another

 
 
New Member
Join Date: Dec 2008
Posts: 3
 
      8th Jan 2009
Hi folks, I am trying to write some VB code that allows the user to select a range via an input box, then copy that range and paste it into a different worksheet.
The code I have written allows the selection OK, but I can't get it to paste into the correct position in the other worksheet. What is supposed to happen is the code finds the next blank row and then pastes the selection underneath. It the moment it pastes into whatever cell was last selected.
Can anybody help?

Sub GetRange()
Dim oRangeSelected As Range
Dim NextRow As Long
Dim LastRow As Long
On Error Resume Next
Sheets("Data").Activate
Set oRangeSelected = Application.InputBox("Please select a range of cells!", _
"Select A Range", Selection.Address, , , , , 8)
If oRangeSelected Is Nothing Then
MsgBox "It appears as if you pressed cancel!"
Else

Range(oRangeSelected).Select
Selection.Copy
Sheets("Sampled Data Summary").Activate
NextRow = Application.WorksheetFunction.CountA(Range("A:A")) + 1
With Sheets("Sampled Data Summary")
Range("A3").Select
Cells(3, 1) = ActiveSheet.Paste

End With
End If
End Sub
 
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
Copy Paste from Class Sheet to Filtered List on Combined Sheet prkhan56@gmail.com Microsoft Excel Programming 6 16th Sep 2008 04:30 PM
Help to code Macro to Copy fron one sheet and paste in other sheet kay Microsoft Excel Programming 3 25th Jul 2008 06:46 PM
Copy from one Sheet and paste on another sheet based on condition Prem Microsoft Excel Misc 2 24th Dec 2007 05:05 AM
Active Cell Copy And Paste Sheet to Sheet =?Utf-8?B?QS5SLkogQWxsYW4gSmVmZmVyeXM=?= Microsoft Excel New Users 4 4th May 2006 02:04 AM
automatic copy and paste from sheet to sheet in a workbook =?Utf-8?B?cmFtc2V5anJhbXNleWo=?= Microsoft Excel Programming 6 11th Dec 2004 12:37 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 11:30 AM.