View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
beecher beecher is offline
external usenet poster
 
Posts: 14
Default Is there a formula that can find the cell corresponding to a t

Hey Ken,

Thanks for the help. I am a little unfamiliar with UDF's. Where should I
put this formula? In the visual basics editor? Also, would there happen to
be a macro that I could put straight into the excel spreadsheet to give the
desired results? Thanks so much, Beecher

"Ken Johnson" wrote:


Hi beecher,

This UDF seem to do that...

Public Function INCREMENTROW(SEARCHRANGE As Range, _
INSTANCE As Long) As String
Dim rngCell As Range
Dim K As Long
Dim lInstanceCheck As Long
Dim lCells As Long
lCells = SEARCHRANGE.Cells.Count
For Each rngCell In SEARCHRANGE
K = K + 1
If K = lCells - 1 Then Exit For
If rngCell.Value = rngCell.Offset(1, 0).Value - 1 Then
lInstanceCheck = lInstanceCheck + 1
If lInstanceCheck = INSTANCE Then Exit For
End If
Next rngCell
If lInstanceCheck < INSTANCE Then Exit Function
INCREMENTROW = rngCell.Address
End Function

Ken Johnson