runtime error 1004 paste method of worksheet class failed

mgar2668

New Member
Joined
Jan 13, 2016
Messages
1
Hi All!

I keep receiving an error when copying data over:
"runtime error 1004 paste method worksheet class failed" at ActiveSheet.Range

Rich (BB code):
 Sheets("Macro").Select    Cells.Select
    Range("A1").Select
    ActiveSheet.Range
    Columns("D:D").Select
    Selection.Insert Shift:=xlToRight
    Selection.Insert Shift:=xlToRight
    Selection.Insert Shift:=xlToRight
    Selection.Insert Shift:=xlToRight
    Selection.Insert Shift:=xlToRight
    Columns("C:C").Select
    Selection.TextToColumns Destination:=Range("C1"), DataType:=xlDelimited, _
        TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=True, Tab:=False, _
        Semicolon:=False, Comma:=False, Space:=True, Other:=True, OtherChar:= _
        "-", FieldInfo:=Array(1, 1), TrailingMinusNumbers:=True
    Cells.Select
    Selection.AutoFilter
    ActiveSheet.Range("$A$1:$S$16287").AutoFilter Field:=9, Criteria1:="QC"
    ActiveSheet.Range("$A$1:$S$16287").AutoFilter Field:=4, Criteria1:=Array( _
        "High", "Low", "Mid"), Operator:=xlFilterValues
    Columns("R:R").Select




End Sub
I'm extremely new to VBA so I would really appreciate any pointers.

Thanks!
MG
 

Some videos you may like

Excel Facts

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.

cerfani

Well-known Member
Joined
Dec 15, 2014
Messages
1,136
ActiveSheet.Range is an incomplete statement, just delete it... it should be used as a function and it returns a range object that you can work with in vba
 

cerfani

Well-known Member
Joined
Dec 15, 2014
Messages
1,136
really annoying how you cant edit but i wanted to add... you use Range method like this...

Dim r as Range
Set r = ActiveSheet.Range("A1")

Now you can do stuff with cell A1, like, editing it's value for example...

r.Value = 1
 

Watch MrExcel Video

Forum statistics

Threads
1,095,752
Messages
5,446,289
Members
405,395
Latest member
anilals

This Week's Hot Topics

Top