Engineer Joe
Well-known Member
- Joined
- Jun 10, 2005
- Messages
- 549
I'm running a loop, and in the loop i refer to a range (via offset) that may not exist...for example if i use RNG as a range variable and then refer to RNG.offset(0,-1), this gives me an error if the range is in column A. I use an error statement to bypass the whole process
It works the first time that i execute the loop, but never the second time. It always brings up the error statement 1004 (presumably indicating that i'm trying to reference an object that doesn't exist.)It's like the On Error statement is only good for one time. Is there a line of code i have to use to reinitiate the On error statement. Is it because I've already thrown an error once? This has never happened me before with an error, but it could be because i've never had more than one error in a procedure... Is there something i must do to set it up again. Remember, it always works the first time i throw an error, but not the second.
Code:
On Error Goto NoRef:
It works the first time that i execute the loop, but never the second time. It always brings up the error statement 1004 (presumably indicating that i'm trying to reference an object that doesn't exist.)It's like the On Error statement is only good for one time. Is there a line of code i have to use to reinitiate the On error statement. Is it because I've already thrown an error once? This has never happened me before with an error, but it could be because i've never had more than one error in a procedure... Is there something i must do to set it up again. Remember, it always works the first time i throw an error, but not the second.