VBA Run-time error 424

markman235

Board Regular
Joined
May 10, 2011
Messages
52
Hi everyone,

I am having some issues with this marco, and full disclosure, I don't know much about macro's at all.

But i am getting a runtime 424 error whenever i try to run this. The purpose is to pull from a list of employee numbers and print them on a safety inpection sheet.

Any help is greatly appreciated.

Thanks,

Mark

Sub emp()
Dim c As Range
For Each c In EmployeeList.Range("A2", EmployeeList.Cells(Rows.Count, 1).End(x1Up)) 'makes range dynamic
If c <> "" Then CBIFront.Range("A12") = c.Value
If c <> "" Then CBIFront.Range("C2") = c.Value
CBIFront.PrintOut
CBIBack.PrintOut
Next
End Sub
 

Excel Facts

What is the shortcut key for Format Selection?
Ctrl+1 (the number one) will open the Format dialog for whatever is selected.
This is wrong
Code:
.End(x1Up))
it should be a lower case L not a 1
Also is EmployeeList a sheet codename?
 
Last edited:
Upvote 0
Oh good grief, lol. Thank you!

So the three tabs are named CBI Front, CBI Back, and Employee List. I just thought that you couldn't have spaces in macros for tab names.
 
Upvote 0
If they are sheet codenames, they can't have spaces.
If you look in the VBAProject window you should see something like Sheet1(Data) where Sheet1 is the code name & Data is the actual sheet name.
Is EmployeeList a code name, sheet name, or maybe a variable has has been declared & set elsewhere?
 
Upvote 0
oh!!! I never would have noticed that!

Man, you are good!!! I will change the tab names to the sheet numbers without spaces.
 
Upvote 0

Forum statistics

Threads
1,223,903
Messages
6,175,284
Members
452,630
Latest member
OdubiYouth

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