Copy paste from another sheet

Nick70

Active Member
Joined
Aug 20, 2013
Messages
299
Office Version
  1. 365
Platform
  1. Windows
Hi,

I have a macro that runs when dropdown in C8 has value "Client" (in sheet Relationship Profile Summary Form).

When C8 is "Client" then two macros are called macro Unhide and macro Paste.

I get an error message with macro Paste.
Error says: Run-time error '1004':
Method 'Paste' of object'_Worksheet' failed

Can you please see code for macro Paste and let me know if you see anything wrong?


VBA Code:
Sub Paste()

Sheets("Sheet1").Activate

    Range("C6:C6").Select
    Selection.Copy
    
Sheets("Relationship Profile Summary").Activate
    
    Range("D40:D40").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
 
 End Sub

The macro Paste is supposed to copy cell C6 from Sheet1 and paste it in sheet Relationship Profile Summary in cell D40.

Also the macro that kicks off macro Paste has code below:

Code:
Sub worksheet_change(ByVal target As Range)

If target.Address(0, 0) = "B4" Then
If target.Value = "Escalation Form" Then
 Call Expand
ElseIf target.Value = "Relationship Profile Summary Form" Then
Call Collapse
End If
ElseIf target.Address(0, 0) = "C8" Then
Set target = Range("C8")
If target.Value = "Counterparty" Then
Call Hide
Call Clear
ElseIf target.Value = "Client" Then
Call Unhide
Call Paste
ElseIf target.Value = "Business Partner" Then
Call Unhide
Call Paste
End If
End If

End Sub

Many Thanks,
N.
 

Excel Facts

Get help while writing formula
Click the italics "fx" icon to the left of the formula bar to open the Functions Arguments dialog. Help is displayed for each argument.
What happens with
VBA Code:
Sub Paste()

Sheets("Sheet1").Range("C6").Copy
    
Sheets("Relationship Profile Summary").Range("D40").PasteSpecial Paste:=xlPasteValues
 
End Sub
 
Upvote 0

Forum statistics

Threads
1,214,574
Messages
6,120,329
Members
448,956
Latest member
Adamsxl

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top