But what happens? Does it require you to kill the Excel process and restart? I suggest you look at Task Manager, Performance tab, and see what kind of CPU Excel is burning up. If it is using more than 0%, your code is in an infinite loop (actually it will probably be something like 50-99% if that is the case). You have a loop in Sub Lines that has the potential to go infinite, or at least long. Are you doing exactly the same thing on both computers? Starting on the same worksheet, same data, etc.?
I don't know what is wrong in your specific situation but I'll give you some suggestions.
You have placed your code in Modules. That's often a good idea, but be aware that when you use an expression like
you have not specified which worksheet you're referring to. Therefore it will refer to whatever sheet is active. (Code like that in a Sheet module will refer to that sheet.) Your code does not activate a sheet, so you are at the mercy of your user to have the right sheet selected. You should generally be explicit and use spmething like this:
It is not necessary to Select a range just to do something with it.
There are several things I would do differently in this blurb of code:
rewritten as:
In Sub Lines I highly discourage you from using the GoTo. This tends to create convoluted flow through the code. If you were to draw a line from every GoTo to every target, you will get what looks like a bowl of spaghetti, hence the term "spaghetti code."
In the same place, use indentation to reflect your If and loop structures.
Use comments. I can't figure out what you're trying to do. Well, I could if I spent another 20 minutes, but a few comments would have told me immediately.
Bookmarks