Find doesn't find...what the !@#$
Do you have a separate function for "GetTabNames" ? If not, then the Find
will only apply to the active sheet. However, you should be getting errors
before it gets to the Find statement.
"RocketMan" wrote:
So, I have a fuction that should find the top and bottom row in column
A that has term Cat(j). However, the top works all the time and the
bottom only works when I specifically set it to A65535, otherwise its
A1. HELP:
dim Cat() as string
dim TabNames() as string
dim TopCell as Range
dim BottomCell as Range
Cat = GetCategories
TabNames = GetTabNames
for i = 0 to UBound(TabNames)
Set TopCell = Worksheets(TabNames(i)).Range("A1")
Set BottomCell = Worksheets(TabNames(i)).Range("A65535")
With Worksheets(TabNames(i)).Range("A:A")
for j = 0 to UBound(Cat)
Set TopCell
= .Find(What:=Cat(j),After:=TopCell,LookIn:=xlValues ,SearchOrder:=xlByRows,SearchDirection:=xlNext)
Set BottomCell = .Find(What:=Cat(j),After:=
BottomCell,LookIn:=xlValues,SearchOrder:=xlByRows, SearchDirection:=xlPrevious)
next j
Next I
|