Run-time error 1004 Copy and Paste

Sherifa

New Member
Joined
Oct 23, 2017
Messages
45
I have tried a number of different variations to copy and paste but they are not working.
I keep experiencing a run time error.

Rich (BB code):
Sub Filter()






Dim Wkb As Excel.Workbook
Dim ws As Sheets
Dim i As Long
Dim LastRow As Long
Dim LastRow1 As Long
Dim Rng As Range
Dim deleteRange As Range
 
Set Wkb = ThisWorkbook
Set ws = ThisWorkbook.Worksheets
ws_count = Wkb.Worksheets.Count


Sheets("MYA Dump").Activate
LastRow = Wkb.Worksheets("MYA Dump").Cells(Rows.Count, 1).End(xlUp).Row


    
LastRow1 = Wkb.Worksheets("MYA Dump").Cells(Rows.Count, 1).End(xlUp).Row


ActiveSheet.Range("$A$5:$gh$" & LastRow1).AutoFilter Field:=12, Criteria1:="CGMFL"
ActiveSheet.Range("$A$5:$gh$" & LastRow1).AutoFilter Field:=18, Operator:= _
        xlFilterValues, Criteria2:=Array(0, "12/31/2018")




Sheets("MYA Dump").Activate
Sheets("MYA Dump").Range("A:gh").SpecialCells(xlCellTypeVisible).Copy


Sheets("2018 Raw Data").Activate
Sheets("2018 Raw Data").Range("e:gl").ClearContents
Sheets("2018 Raw Data").Range("e:gl").Selection
Sheets("2018 Raw Data").Range("e:gl").SpecialCells(xlCellTypeVisible).Paste
    'A:DPasteDown




End Sub
 

Forum statistics

Threads
1,081,702
Messages
5,360,743
Members
400,595
Latest member
T_Dubs

Some videos you may like

This Week's Hot Topics

  • VBA (Userform)
    Hi All, I just would like to know why my code isn't working. Here is my VBA code: [CODE=vba]Private Sub OKButton_Click() Dim i As Integer...
  • List box that changes fill color
    Hello, I have gone through so many pages trying to figure this out. I have a 2020 calendar that depending on the day needs to have a certain...
  • Remove duplicates and retain one. Cross-linked cases
    Hi all I ran out of google keywords to use and still couldn't find a reference how to achieve the results of a single count. It would be great if...
  • VBA Copy and Paste With Duplicates
    Hello All, I'm in need of some input. My VBA skills are sub-par at best. I've assembled this code from basic research and it works but is...
  • Macro
    is it possible for a macro to run if the active cell value is different to the value above it
  • IF DATE and TIME
    I currently use this to check if date has passed but i also need to set a time on it too. Is it possible? [CODE=vba]=IF(B:B>TODAY(),"Not...
Top