View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
nick nick is offline
external usenet poster
 
Posts: 192
Default HELP with this code!

Function FindNth(Table As Range, Val1 As Variant, Val1Occrnce As Integer,
ResultCol As Integer)

Dim i As Integer
Dim iCount As Integer
Dim rCol As Range

For i = 1 To Table.Rows.Count
If Table.Cells(i, 1) = Val1 Then
iCount = iCount + 1
End If

If iCount = Val1Occrnce Then
FindNth = Table.Cells(i, ResultCol)
Exit For
End If
Next i
End Function

Hi this is the code that i use to populate nth occurrenece of recurring
data. but in this function i have input the occurrence value manually. but is
there any way that occurrence value changes by itself. for example lets say,
if i have 10 repeating jobs, row 1-10 with different data, for each row in a
different worksheet i wanna get the data from that perticular row. like for
2nd occurrence i want the value taken from 2nd row, 3occurrenece 3rd row n so
on. but i want the fucntion to jump to the next occurence by itself. any
help????