Stuck with my Macro

Loopy86

New Member
Joined
Feb 25, 2010
Messages
38
Hi everyone

Please help - I am stuck.

I keep debugging, and I cannot see why or how to fix it. Think I am going into tunnel vision now.

I have devised a simple (or so I thought) macro to select and copy data, open a file, paste it and now I want to go back to original sheet so I can delete the info I have copied.
This is where I am debugging. I thought I might have to offset the title row, but I have not been successful.

I have code, shall I paste it?

Thanks
 

Excel Facts

How to find 2nd largest value in a column?
MAX finds the largest value. =LARGE(A:A,2) will find the second largest. =SMALL(A:A,3) will find the third smallest
The red is where I am having the problem

Thanks for looking

'Move data onto file and filter
ActiveSheet.Range("$A$1:$F$1048576").AutoFilter Field:=1, Criteria1:="K. Askew"
Cells.Select
Selection.Copy
Windows("_KA Template.xlsm").Activate
Sheets("New Enquiry").Select
Range("A1").Select
ActiveSheet.Paste
Windows("Sales Activity Template.xlsm").Activate
Sheets("Sheet1").Select
 
Upvote 0
If you avoid selecting/activating you should avoid that problem

Code:
With Range("$A$1:$F$1048576")
    .AutoFilter Field:=1, Criteria1:="K. Askew"
    .SpecialCells(xlCellTypeVisible).Copy Destination:=Workbooks("_KA Template.xlsm").Sheets("New Enquiry").Range("A1")
End With
 
Upvote 0
Hi, i'm back!!

I have a run-time error:
"Unable to get the specialcells property of the range class

Sorry, I feel like a nuisance:confused:
 
Upvote 0
Maybe this instead

Code:
Columns("A:F").AutoFilter Field:=1, Criteria1:="K. Askew"
ActiveSheet.UsedRange.SpecialCells(xlCellTypeVisible).Copy Destination:=Workbooks("_KA Template.xlsm").Sheets("New Enquiry").Range("A1")
 
Upvote 0

Forum statistics

Threads
1,224,596
Messages
6,179,807
Members
452,943
Latest member
Newbie4296

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