thanos54321
Programmer
Hi there,
I have a question about the find-function in excel/vba. Basically, I'm just recording the find-function (the ctrl+f one, not some lookup function or whatever), and as a part of a larger sub, the find-function is called within VBA to search for some specific regional names in several sheets.
The problem is, while there are generally four regions, in some sheets only three are there. I have no way of knowing beforehand which ones will be there, so I basically want to find out if it's possible to evaluate a statement like this:
Cells.Find(What:="Japan", After:=ActiveCell, LookIn:=xlFormulas, LookAt _
:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext,_
MatchCase:= False, SearchFormat:=False).Activate
That is, sometimes Japan will not be there, and the vba-code will be terminated prematurely. Basically, I hope there is some way to use the principle applicable in excel, like:
if(iserror(somefunction)=true;something;somethingelse)
but I don't know if it's at all possible...
Anyway, thanks for whatever aid anyone can give on this subject, this is a fantastic forum with fantastic contributors!
Regards Thanos54321
I have a question about the find-function in excel/vba. Basically, I'm just recording the find-function (the ctrl+f one, not some lookup function or whatever), and as a part of a larger sub, the find-function is called within VBA to search for some specific regional names in several sheets.
The problem is, while there are generally four regions, in some sheets only three are there. I have no way of knowing beforehand which ones will be there, so I basically want to find out if it's possible to evaluate a statement like this:
Cells.Find(What:="Japan", After:=ActiveCell, LookIn:=xlFormulas, LookAt _
:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext,_
MatchCase:= False, SearchFormat:=False).Activate
That is, sometimes Japan will not be there, and the vba-code will be terminated prematurely. Basically, I hope there is some way to use the principle applicable in excel, like:
if(iserror(somefunction)=true;something;somethingelse)
but I don't know if it's at all possible...
Anyway, thanks for whatever aid anyone can give on this subject, this is a fantastic forum with fantastic contributors!
Regards Thanos54321