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

Add Bullets to Range
Select range. Press Ctrl+1. On Number tab, choose Custom. Type Alt+7 then space then @ sign (using 7 on numeric keypad)
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,224,823
Messages
6,181,178
Members
453,021
Latest member
Justyna P

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