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
 

Excel Facts

Formula for Yesterday
Name Manager, New Name. Yesterday =TODAY()-1. OK. Then, use =YESTERDAY in any cell. Tomorrow could be =TODAY()+1.
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
 
Upvote 0
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.
 
Upvote 0
Glad you got it sorted & thanks for the feedback
 
Upvote 0

Forum statistics

Threads
1,214,590
Messages
6,120,423
Members
448,961
Latest member
nzskater

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