Good, that's all you needed to do to stop the redundancy; you used
With ~~~, but never used the dot notation that goes with it, so the
With…End With wouldn't have worked.
It should do except you've got to get the workbook's name correct; is it
Centris or
Centris Periods?
It's little inaccuracies like these that lead to
Subscript out of range errors.
The names of the WBs are correct. As I indicated earlier I added the dots.
They save you time when writing the code in several ways; you don't have to keep retyping the references, just use a dot. If you want to change something in the references you only need do it it one place. I've heard that it's less resource hungry because the references don't have to be interpreted every time.
Will adopt this approach.
WHAT??!! The subject of this thread is
Subscript out of range problem. Those 3 lines of code were designed to find which of the subscripts was out of range…
nothing else. Have you solved the problem without telling us?!
As part of earlier post I thanked everyone for their replies and indicated that the problem had been solved. I had the wrong WB active when running the Sub. That message doesn't seem to have "taken". Perhaps part of a reply was erased before I sent it.
Something along the lines of
Set being needed when the variable is an
object variable as opposed to being a plain old variable. The variable in this case is very probably an object, because it looks like you intended them to be ranges with the line:
Dim Rng1A, Rng2A, Rng1I, Rng2I As Range 'range blocks to copy
which only
Dims
Rng2I as a range. You probably intended:
Dim Rng1A As Range, Rng2A As Range, Rng1I As Range, Rng2I As Range 'range blocks to copy