• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

macros to copy and paste to range you select

hello
could you please help me to asign macro to the attached sheet to copy the cells from the range D7 To D11 and paste them to another excel sheet and allow to select the range that it will paste to
 

Attachments

  • Out-put Calculator LK 2015 31.12.2014.xlsx
    124.3 KB · Views: 9
If others need, the password to unlock the workbook:
AAAABABAAAA]

Here's is a macro that does what you asked.
Code:
Sub CopyRange()
Dim sourceRng As Range
Dim destRng As Range

On Error Resume Next
Set destRng = Application.InputBox("Where do you want to paste to?", "Destination range", , , , , , 8)
On Error GoTo 0
If destRng Is Nothing Then Exit Sub

'What do we copy?
Set sourceRng = Worksheets("Out-put (Lay-up & PB)").Range("D7:D11")
Application.ScreenUpdating = False
'Perform the copy/paste
sourceRng.Copy
destRng.PasteSpecial xlPasteValues

Application.CutCopyMode = False
Application.ScreenUpdating = True
End Sub
 
hello Luke M
thank you for your support the above macros is so close to what i need to do but whene i try to choose the workbook that i want to paste to in another excel workbook it dosn't let me navigate to it so please if you can help me with this
 
That would be because you stated in OP that you wanted to copy to a different sheet, not a different workbook.

To do what you ask in a different workbook would require an UserForm. See here for how to build one:
http://stackoverflow.com/questions/18125650/vba-dialog-box-to-select-range-in-different-workbook

Alternatively, I might just suggest you add a macro like this to your Quick Access Toolbar
Code:
Sub CopyRange()
Dim sourceRng As Range
Dim destRng As Range

'What do we copy?
Set sourceRng = ThisWorkbook.Worksheets("Out-put (Lay-up & PB)").Range("D7:D11")
Application.ScreenUpdating = False
'Perform the copy/paste
sourceRng.Copy
ActiveCell.PasteSpecial xlPasteValues

Application.CutCopyMode = False
Application.ScreenUpdating = True
End Sub

Then, you can navigate to whichever workbook/worksheet you want, hit the button on the QAT, and the information will be copied.
 
Back
Top