Hello to all and thankyou for reading this.
My macro keeps getting an error on line 8 " wk.select "
Why is this ? Any help will be appreciated !!!
Aloha to all.
Please Login or Register to view this content.
Hello to all and thankyou for reading this.
My macro keeps getting an error on line 8 " wk.select "
Why is this ? Any help will be appreciated !!!
Aloha to all.
Please Login or Register to view this content.
I suspect that you have a hidden worksheet or two
Trevor Shuttleworth - Retired Excel/VBA Consultant
I dream of a better world where chickens can cross the road without having their motives questioned
'Being unapologetic means never having to say you're sorry' John Cooper Clarke
Hello,
Thankyou for your reply, I checked for hidden worksheets and there are none.
Hello,
Thankyou for your reply, I checked for hidden worksheets and there are none.
Any charts, protected worksheets? Is the structure of the workbook protected?
Barring defining the variable i, your code runs unchanged. I don't know if it does what it is intended to do, but it runs through three sheets. So I'd say the code is ok and it's something to do with the workbook.
Try it in an empty workbook.
Hello,
Thankyou very much for your reply, much appreciated.
I do not have any charts or protected sheets. The empty workbook seemed like a good idea and I got excited for a second until I tried it.
It still doesn't work.
Hmmmm
I am getting run time error 1004
Is it possible to post example workbook so we can see what's your code supposed to do? There's too much Select, ActiveCell in your code because there's no need to select each sheet to perform those actions.
It will also make your code run much smoother and faster.
Avoid using Select, Selection and Activate in your code. Use With ... End With instead.
You can show your appreciation for those that have helped you by clicking the * at the bottom left of any of their posts.
Hello,
I figured it out. I changed ThisWorkbook.Worksheets to ActiveWorkbook.Worksheets,
Thankyou very much for your time. I try to avoid using select etc.. in the code but I do not know of another way. I truly wish I did.
Hello,
I figured it out. I changed ThisWorkbook.Worksheets to ActiveWorkbook.Worksheets,
Thankyou very much for your time. I try to avoid using select etc.. in the code but I do not know of another way. I truly wish I did.
You're welcome. Thanks for the rep.
ThisWorkbook is the workbook with the code in it. The ActiveWorkbook is what it says on the tin. Clearly not the same in this instance.
You're welcome. Thanks for adding rep points.
Will try later to adapt your code without Select, Activecell etc...
As promised. Try this out.
Please Login or Register to view this content.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks