Home |
Search |
Today's Posts |
#8
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Alice
Thanks for the feedback. I guess VBA is one of those things where you just keep learning new tricks all the time ;-) With regard to Bob's code: ' set the variable dType to blank (a known state, not carried forward from previous test(s)) dType = "" ' switch on Error Trapping - so that the code will continue to the next line whatever happens On Error Resume Next ' set dType to the Validation Type for the cell ... which will cause an error if there isn't any dType = .Validation.Type ' switch off Error Trapping ... and, in this case,is quite nicely the *next line* for the Resume Next On Error GoTo 0 ' test the dType variable which will be blank if there was no Validation (having pre-set it above) If dType < "" Then Hope that makes it clearer. You should always keep the error trapping range to a minimum as other errors could be missed and, although it means your code won't fail, you may not get the results you expect. Regards Trevor wrote in message ups.com... On Sep 21, 4:51 pm, "Trevor Shuttleworth" wrote: Alice the piece of code shown is missing an End If inside the For Loops. Probably won't help ;-) You should surround the code that can generate the error with On Error Statements On Error Resume Next ' switch on error trapping ' code that can produce the error On Error Goto 0 ' switch off error trapping ' test for error condition As it stands, the first time you go through the loop you switch on error trapping and it stays on Regards Trevor wrote in message ups.com... Thanks, Trevor. I see that Bob Phillips example had the two error traps as you stated, but I didn't know why. I often feel that VBA is like a foreign language where I just don't know enough words. Things almost make sense, and after a lot of labor, I can usually get close to what I want, but the fine details still elude me! Alice |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
on error resume next | Excel Programming | |||
Resume on Error? | Excel Programming | |||
On Error {...} Resume Next | Excel Programming | |||
On error resume next? question - problem | Excel Programming | |||
"On Error Resume Next" Question | Excel Programming |