Firstly what are you trying to achieve here?
It seems you are locking several ranges of cells but the way that they are locked means that once they are locked, they can't be unlocked?
As an overall guide, are all the lines you want to work on grouped together, (ie. lines 11 to 50), or are they random lines all over the worksheet?
If the former you can use a For loops to work through the lines directly, if the latter I would create an array of the line numbers and then use a For loop to step through that.
As for the speed, you must remember that the 'Change' event is called each time the spreadsheet changes, which is likely to be what is slowing it down. Each of the cases doesn't need to run everytime, only if what it depends on is affected.
For example:
The outcome of that code will only be different if either the value of I11, or J11 has just been changed.
The 'Target' variable of the onchange event tells you what has just changed, so you can check to see if either I11 or J11 were involved. If they were then execute your IF statement, if not then dont bother.
Do you have a sheet with some example data so that we can see how you are intending this macro to be used? (It will also allow us to see the flickering you describe, and just how slow it is).
Bookmarks