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

Can Excel fill bagel flavors?
You can teach Excel a new custom list. Type the list in cells, File, Options, Advanced, Edit Custom Lists, Import, OK

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
58,345
Office Version
  1. 365
Platform
  1. 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
58,345
Office Version
  1. 365
Platform
  1. Windows
Glad you got it sorted & thanks for the feedback
 

Watch MrExcel Video

Forum statistics

Threads
1,133,149
Messages
5,657,123
Members
418,356
Latest member
CSWorker

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
Top