خرید بک لینک

Vote count: 0

I want to create a counter in a routine that will count how many times a specific entry has appeared so far.

The routine that i have created so far populates data in a spreadsheet through a For..Next Loop. For each of these rows i have an extra column that will represent the counter and count how many times a characteristic of the entry row has appeared so far in the previous rows. For that, I am using the application.worksheetfunction.CountIf function but the reference range has to be dynamic.

The function that i created is as follows:

Public Function ReCounter(Rng as range, recat as string) as integer
Dim i as integer, j as integer, ReCounterArr() as string

for j=1 to i 'where i is the current line in the main routine loop
ReDim ReCounterArr(0 to i,53) '53 is the column number that i want to reference
ReCounter=application.worksheetfunction.CountIf(ReCounterArr,Recat)
next J

Any suggestion/correction will be very much appreciated!

asked 1 min ago

برچسب: نویسنده: استخدام کار تاريخ: يکشنبه 30 خرداد 1395 ساعت: 15:31

صفحه بندی