What's wrong with this VBA program??

abnankash

New Member
Joined
Feb 6, 2011
Messages
8
Code:
Sub abc()

Dim AsiaELNpath As String
Dim AELN As Workbook
 
AsiaELNpath = "X:\Asia ex HK ELN Indications\Daily ELN Indications (Base) Asia ex HK.xls"
 
Set AELN = Workbooks.Open(AsiaELNpath)

ThisWorkbook.Worksheets("Asia Stocks").Range("A1:Z100").Copy

AELN.Worksheets("Database").Range("A1:Z100").Pastespecial

End Sub

I used F8 to run codes row by row. When it comes to the last row it crashed with a bug.
It said that it had a run-time error '40036':
Application-defined or object-defined error

I double checked the name of the worksheet of both workbooks. I can't figure out what the problem is...spent me 2hrs...help
 

Excel Facts

What is the shortcut key for Format Selection?
Ctrl+1 (the number one) will open the Format dialog for whatever is selected.
Not sure but try

Code:
AELN.Worksheets("Database").Range("A1").PasteSpecial Paste:=xlPasteValues
 
Upvote 0

Forum statistics

Threads
1,224,590
Messages
6,179,762
Members
452,940
Latest member
rootytrip

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