Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using PasteSpecial command on multiple sections in excel

Status
Not open for further replies.

WeAreNotAlone

Technical User
Mar 27, 2005
10
US
Hi all

I am using a command button in my excel sheet to copy several cells and copy them into a different workbook.

Here is the code

Private Sub CommandButton1_Click()
Application.ScreenUpdating = False
Workbooks("EQPDuration.xls").Activate
Sheets("Eqp Summary").Activate
ActiveSheet.Range("A1,A3").Copy

Workbooks("FILMS DAYS.xls").Activate
Sheets("Performance").Activate
ActiveSheet.Range("A5,A7").Select
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:=False, Transpose:=False
Application.ScreenUpdating = True
End Sub

this errors and says that the PasteSpecial command cannot be used on multiple selections. How do i select different cells and use PasteSpecial to put them into different cells.

Thanks

Mally
 
you would need to do it in seperate actions.
1 paste to A5
Another paste to A7

Rgds, Geoff

"Three things are certain: Death, taxes and lost data. Guess which has occurred"

Please read FAQ222-2244 before you ask a question
 
Thanks xlbo

I was hoping to avoid that. Well i'll go away and paste my 16,250 seperate actions. He he. Only joking.

Mally

 
Hi,
Code:
Private Sub CommandButton1_Click()
    Application.ScreenUpdating = False
    Workbooks("EQPDuration.xls").Sheets("Eqp Summary").Range("A1,A3").Copy
       
    With Workbooks("FILMS DAYS.xls").Sheets("Performance")
        .Range("A5").PasteSpecial _
            Paste:=xlValues, _
            Operation:=xlNone, _
            SkipBlanks:=False, _
            Transpose:=False
        .Range("A7").PasteSpecial _
            Paste:=xlValues, _
            Operation:=xlNone, _
            SkipBlanks:=False, _
            Transpose:=False
    End With
    Application.ScreenUpdating = True
End Sub

Skip,

[glasses] [red]Be advised:[/red] When you ignite a firecracker in a bowl of vanilla, chocolate & strawberry ice cream, you get...
Neopolitan Blownapart! [tongue]


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top