Runtime error 9 excel macro

Cravengame

New Member
Joined
May 8, 2018
Messages
3
I'm not sure what I'm doing wrong when entering this code, but I did use it before and I'm not sure what I did the last time. Basically what i'm trying to do is to copy a range of columns and paste them into another set of columns. When I type the macro the error comes up for the first line.

Private Sub CommandButton11_Click()
Sheets("NEW VENDOR SUMMARY").Range("Z3:Z866").Delete (<- this line is yellow)
Sheets("NEW VENDOR SUMMARY").Range("M3:M").Copy
Sheets("NEW VENDOR SUMMARY").Range("Z3").PasteSpecial (xlPasteValues)
Application.CutCopyMode = False


Sheets("NEW VENDOR SUMMARY").Range("L3:L").Copy
Sheets("NEW VENDOR SUMMARY").Range("M3").PasteSpecial (xlPasteValues)
Application.CutCopyMode = False


Sheets("NEW VENDOR SUMMARY").Range("K3:K").Copy
Sheets("NEW VENDOR SUMMARY").Range("L3").PasteSpecial (xlPasteValues)
Application.CutCopyMode = False


Sheets("NEW VENDOR SUMMARY").Range("J3:J").Copy
Sheets("NEW VENDOR SUMMARY").Range("K3").PasteSpecial (xlPasteValues)
Application.CutCopyMode = False


Sheets("NEW VENDOR SUMMARY").Range("I3:I").Copy
Sheets("NEW VENDOR SUMMARY").Range("J3").PasteSpecial (xlPasteValues)
Application.CutCopyMode = False


Sheets("NEW VENDOR SUMMARY").Range("H3:H").Copy
Sheets("NEW VENDOR SUMMARY").Range("I3").PasteSpecial (xlPasteValues)
Application.CutCopyMode = False




Sheets("NEW VENDOR SUMMARY").Range("G3:G").Copy
Sheets("NEW VENDOR SUMMARY").Range("H3").PasteSpecial (xlPasteValues)






MsgBox "Data Updated"


End Sub
 

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
33,967
Office Version
365
Platform
Windows
Hi & welcome to MrExcel.
Not sure why your code would fail on the 1st line, but all your .copy lines are wrong
Code:
Sheets("NEW VENDOR SUMMARY").Range("[COLOR=#ff0000]M3:M[/COLOR]").Copy
The part in red is not a valid range as you haven't specified a row value for the 2nd M
 

Cravengame

New Member
Joined
May 8, 2018
Messages
3
Hey I fixed that. I realized i copied them wrong when i posted them. I was trying a whole bunch of other things to see if it would work. Thanks for the help.
 

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
33,967
Office Version
365
Platform
Windows
Glad you got it sorted & thanks for the feedback
 

Forum statistics

Threads
1,086,122
Messages
5,387,970
Members
402,091
Latest member
thomastsiakis

Some videos you may like

This Week's Hot Topics

Top