I have a strange little error coming up here. I keep getting the message "Subscript out of range" when I execute the following code:
Range(Worksheets(1).HPageBreaks(Cnter).Location.Address).Select
The odd thing is when I run the following code:
Msgbox(Worksheets(1).HPageBreaks.count), I get a value of 3. The variable cnter has a value of 2, so there should be no problem. If I substitute the variable Cnter with the value 1, I have no problem, but if I put in a 2, I get the error again.
Even more odd is that if I step through the code, I don't get an error message. What is happening here?!! Any ideas.
I came across a similar problem at
thread707-244204 there was no solid solution.
Range(Worksheets(1).HPageBreaks(Cnter).Location.Address).Select
The odd thing is when I run the following code:
Msgbox(Worksheets(1).HPageBreaks.count), I get a value of 3. The variable cnter has a value of 2, so there should be no problem. If I substitute the variable Cnter with the value 1, I have no problem, but if I put in a 2, I get the error again.
Even more odd is that if I step through the code, I don't get an error message. What is happening here?!! Any ideas.
I came across a similar problem at
thread707-244204 there was no solid solution.