Dumbest question asked on MrExcel here

Hlatigo

Well-known Member
Joined
Jun 3, 2002
Messages
677
I am trying to copy and paste from one workbook to another. It worked yesterday but for some reason it isnt working today. I have tried everything i know (which isn't much) but i still get a run-time error "object doesn't support this property or method."


The code is below and it is erroring out on Range("A1").active.
I have aslo tried:
Cells(1,1).active
Range("a1").select
Range("A1").paste

So if anyone can help me that would be awesome

Code:
pplication.AskToUpdateLinks = True
        Sheets(8).Activate
        Sheets(8).Range("AA100:AI115").Select
        Selection.Copy
        Windows("LPGS.xls").Activate
        Sheets(2).Activate
        Range("A1").Active
        ActiveCell.Paste
        Windows(FileName).Activate
        Application.CutCopyMode = False
        ActiveWindow.Close
 

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().
Thanks for the reply and I have made that correction and I still get the same error.

any other thoughts


Code:
        Application.AskToUpdateLinks = True
        Sheets(8).Activate
        Sheets(8).Range("AA100:AI115").Select
        Selection.Copy
        Windows("LPGS.xls").Activate
        Sheets("Currentprice").Activate
        Range("a1").Activate
        ActiveSheet.Paste
        Windows(FileName).Activate
        Application.CutCopyMode = False
        ActiveWindow.Close
 
Upvote 0
I have no idea why i have to do this but this is what i did to finally get it to work? does anyone know if some computers have different settins it will affect which way to use?


Application.AskToUpdateLinks = True
Sheets(8).Activate
Sheets(8).Range("AA100:AI115").Select
Selection.Copy
Windows("LPGS.xls").Activate
Sheets("Currentprice").Activate
Sheets(2).Range("a1").Select
ActiveSheet.Paste
Windows(FileName).Activate
Application.CutCopyMode = False
ActiveWindow.Close
Windows("LPGS.xls").Activate
Sheets(1).Range("a1").Select
 
Upvote 0
Yes, I have some PC's that the only way to get the code to run is:

Sheets("Sheet1").Select
Sheets("Sheet1").Range("A1").Select

If I code it as just this:
Sheets("Sheet1").Range("A1").Select
or only:
Range("A1").Select
with no:
Sheets("Sheet1").Select
before it, then it fails.

And on other PC's this works fine all by itself:
Range("A1").Select
Or
Sheets("Sheet1").Range("A1").Select

And, I have never been able ti find out why, It fails sometimes?

You do know that a Standard Module, like: Module1 needs a more defined structure than a Sheet Module. On a Sheet Module it is assumed that it's sheet is the default sheet for that Module.
 
Upvote 0

Forum statistics

Threads
1,203,642
Messages
6,056,507
Members
444,872
Latest member
Vishal Gupta

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