View Single Post
  #5   Report Post  
Richards
 
Posts: n/a
Default



"Frank Kabel" wrote:

Hi
I'd guess that your problem is at least in the following lines of code:
----------
col = getCellCol(searchColStr)
row = getCellRow(searchColStr)
Dim temp As String

compCol = getCellCol(compColStr)
compRow = getCellRow(compColStr)
While IsEmpty(Cells(row, col)) = False
temp = Cells(compRow, compCol).Value
----------

Not sure what getCellCol and getCellRow do (and why you use them at all) but
you're using in the following lines
Cells
without specifying the worksheet object. So this takes the values from your
CURRENT ACTIVE sheet. So you may use
searchColRng.parent.cells(....)
to use the right worksheet object.

Also I'm not sure what you're trying to do with this but I'd guess you could
achieve the same with a worksheet formula


--
Regards
Frank Kabel
Frankfurt, Germany

Richards wrote:
"Frank Kabel" wrote:

Hi
you may post your UDF code

--
Regards
Frank Kabel
Frankfurt, Germany




Frank,

That was it. I added the "sheet " qualifier and that "Fixed " my problem.
Guess I should add the name of the workbook also as there may be times when
I could have this workbook open at the same time as another workbook is
loaded.

Question:
What is the normal method for calling a UDF? Do you pass the name of the
workbook and sheet in the parms along with the Cell or Range?

(getCellCol and getCellRow accept a string format rference to a single cell
, (like "A1"), and return an intger representing the column/ row . Handy if
you want to loop through a range.
The entire function returns the number of entries in a column that match
the supplied string, starting at location searchColRng, and going down until
it encounters a blank cell .)