Results 1 to 4 of 4

Sub to Copy and Paste a Range of Cells

Threaded View

  1. #1
    Registered User
    Join Date
    07-06-2010
    Location
    England
    MS-Off Ver
    Excel 2007
    Posts
    5

    Sub to Copy and Paste a Range of Cells

    This should be really simple, but I keep getting error messages when I try to paste. Perhaps you can help?
    I first want to select a range of cells with the mouse.
    Then I want an ImputBox to ask me where to Paste to.
    I select a cell with the mouse and press OK.
    At this stage I get an error message, but I am not sure why?
    I have tried each of the bits of code in remarks, but they all give an error message.
    Please could you keep it simple and explain why mine does not work.



    Sub Copy_And_Paste()
    Dim CopyRange As Range
    Dim PasteRange As Range
    
    Set CopyRange = Selection
    
    CopyRange.Select
    
      Selection.Copy
    
        Set PasteRange = Application.InputBox(prompt:="Select Where to Paste to", Type:=8)
    
    Rem *** It works up to here ***
    Rem *** I have tried the following ***
     
    ' PasteRange.Select
    
    ' CopyRange.Paste
    
    ' Selection.Paste
    
    ' Selection.PasteSpecial Paste:=xlValues
    ' Application.CutCopyMode = False
    
    End Sub
    Last edited by FrankB2050; 07-07-2010 at 09:49 AM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1