Macro query

cuiqin1234

New Member
Joined
Jul 9, 2011
Messages
2
Hi, I need some help for the following VBA codes, there is always a error message says" there is not enough resources for completing this command" when i debug the codes, " ActiveSheet.paste" is highlighted.




Sub Hotel()
'
' Hotel Macro
'

Windows("Foodservice database final.xlsm").Activate
Sheets("Database").Select
Range("A1:AE1").Select
Selection.AutoFilter
ActiveSheet.Range("$A$1:$Y$5581").AutoFilter Field:=1, Criteria1:=Array( _
"5a", "5b", "5c"), Operator:=xlFilterValues
Range("A1").Select
Cells.Select
Selection.Copy
Workbooks.Add
Sheets(1).Select
Sheets(1).Name = "Hotel"
Sheets("Hotel").Select
ActiveSheet.paste
Range("A1").Select
Application.CutCopyMode = False
ActiveWorkbook.Save
End Sub
 

Excel Facts

Pivot Table Drill Down
Double-click any number in a pivot table to create a new report showing all detail rows that make up that number
This is just a guess (without trying your code at all), but have you tried moving ActiveSheet.paste below Range("A1").Select (switch places of the two lines).

Cheers, :)
 
Upvote 0
Thank you very much!
I tried (see below) but the same error happened.


Hotel Macro
'

Windows("Foodservice database final.xlsm").Activate
Sheets("Database").Select
Range("A1:AE1").Select
Selection.AutoFilter
ActiveSheet.Range("$A$1:$Y$5581").AutoFilter Field:=1, Criteria1:=Array( _
"5a", "5b", "5c"), Operator:=xlFilterValues
Range("A1").Select
Cells.Select
Selection.Copy
Workbooks.Add
Sheets(1).Select
Sheets(1).Name = "Hotel"
Sheets("Hotel").Select
Range("A1").Select
ActiveSheet("Hotel").paste
Application.CutCopyMode = False
ActiveWorkbook.Save
End Sub
 
Upvote 0

Forum statistics

Threads
1,224,560
Messages
6,179,519
Members
452,921
Latest member
BBQKING

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