Posted to microsoft.public.excel.programming
|
|
Exiting a child macro, where to find more info on error trapping inExcel VBA, and maybe more info on array manipulation
I'd start with Chip Pearson's page about error trapping:
http://www.cpearson.com/Excel/ErrorHandling.htm
I don't know of any resource that can serve as a tutorial on arrays. But you
could try searching google for vba array and whatever specific question you
have.
nj wrote:
OK, I figured out "Exit Sub" and then realized I had structured the
contents of the If statement poorly and didn't need it. LOL
But I'd still love direction to some websites about error trapping and
(unrelated) array manipulation.
thanks!
On Nov 3, 10:05 am, nj wrote:
Hi, folks,
I just used Dave's code below with a .find in a macro I'm working
(worked perfectly, of course). Now I have a followup question... might
be a couple of questions, I suppose.
This occurs in a child macro and "If foundcell is nothing", what needs
to happen is for that child macro to end and control return to the
parent macro. I've played around with a couple commands but I'm not
getting exactly the behavior I'm after.
I was kind of thinking it would be Exit, but maybe with a parameter or
something. So question #1 is, is there something like that?
But now I'm suspected this is running me back to an old weakness in my
coding skills, namely error-trapping, so question #2 is, can any of
you point me to a webpage will full-on coverage of VBA error trapping?
I understand it in theory but have never gotten around to using it, so
every time I try, it seems like syntax stops (and I find a workaround
faster).
Along the same lines, I've dodged arrays for these many long years,
but would really like to master those puppies. Any place with a
comprehensive coverage of that?
Honestly, my ideal would have exercises, since my brain is being
resistant - lol. How sad is that?!
Thanks so much. This group is a killer resource - I tell people about
this forum all the time.
nj
On Oct 30, 7:48 am, Dave Peterson wrote:
If you're using the Find method, I think you'll be better served by using
something like:
Dim FoundCell as Range
...
with someRangeHere
set foundcell = .cells.find(What:="something", After:=.cells(1), _
LookIn:=xlFormulas, _
LookAt:=xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False)
End with
If foundcell is nothing then
'not found, what should happen
else
'found it. Do what you want to FoundCell here
foundcell.offset(0,1).clearconents 'whatever
end if
==========
If you're using worksheetfunction.find() to check for something in a string,
then useVBA'sinstr() instead.- Hide quoted text -
- Show quoted text -
--
Dave Peterson
|