I don't know what type of variable you are using for x, but instead of setting it to Null, try setting x = "".
This has worked well in my applications, but again I don't know what you are using x for.
I have copied recorded macros to command buttons in the past and been very successful.
Is the button on the same worksheet, a form, etc?
If so, just make sure that your code is in the right spot (ex: if the button is on sheet1, then you have to have the code under sheet1 in VBA).
When you...
Hello.
I have an Excel file that retrieves data from Access. It works fine except when the directory that the .mdb resides is set to read-only (or is on a CD).
When I run my code I get "Run-Time Error '3050': Could Not Lock File."
I know this stems from Access trying to create a...
I have a macro printing 16 sheets at once, but each time I print it sends 3 different print jobs to the printer. How do I make it all one print job? Here is a section of my code:
Sheets(Array(sheet1, sheet2, sheet3, . . . sheet16)) _
.Select
Sheets(sheet16).Activate...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.