Run time error 1004

Sherifa

New Member
Joined
Oct 23, 2017
Messages
45
PasteSpecial METHOD OF RANGE CLASS FAILED

Code:
Sub Testing()
Dim Wkb As Excel.Workbook
Dim ws As Sheets
Dim ws_count As Long
Dim i As Long
Dim j As Integer
Dim k As Integer


Set Wkb = ThisWorkbook
Set ws = ThisWorkbook.Worksheets


ws_count = Wkb.Worksheets.Count




'Begin loop
    For i = 1 To 10


            Call RandNumberGen
            Call SimulatedPath
            
            Sheet6.Calculate
            Sheet7.Calculate
            Sheet8.Calculate
            Sheet9.Calculate
            Sheet10.Calculate
            
            


            For j = 1 To 10
    
    


                 For k = 3 To 13
    
            
                    Sheet11.Range("A1:C12").Copy
                    
                    Sheet11.Range(Cells(1, j + 5), Cells(12, k + 5)).PasteSpecial xlPasteValues
                    
                    'Paste Step Column by 5


        Next k


    Next j
Next i


Sheet11.Calculate


End Sub
 
It maybe that your sheets arn't being fully calculated, before the paste happens.
However as I rarely use much in the way of formulae, I cannot be sure of that & don't how how to get round it.

Hi, you are right.

After following the steps manually, i realised I needed to calculate Sheet 11 before pasting as well, because everything was set to Manual.

Thank you for all your help!
 
Upvote 0

Excel Facts

Add Bullets to Range
Select range. Press Ctrl+1. On Number tab, choose Custom. Type Alt+7 then space then @ sign (using 7 on numeric keypad)
Glad to help & thanks for the feedback
 
Upvote 0

Forum statistics

Threads
1,214,927
Messages
6,122,311
Members
449,080
Latest member
jmsotelo

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