ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   HELP with this code! (https://www.excelbanter.com/excel-programming/342592-help-code.html)

nick

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????


All times are GMT +1. The time now is 11:46 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com