excel - Entering values into an array, and then counting the # of unique values in it -


i writing macro calculates # of unique values within column of worksheet. there few other parameters well, have covered already. trying find out how input values array ( unique () ), , how count # of unique values array. have far.

private sub commandbutton1_click()  dim datecheck string dim lastrow long dim l integer dim long dim shipday date dim search string dim unique() variant dim number string  l = 0 21  ' execute code whole month      shipday = worksheets("june canada").cells(l + 10, 10).text   'sets correct date      = 1 worksheets("sheet1").usedrange.rows.count  ' searches entire worksheet          search = worksheets("sheet1").cells(i, 12).value ' checks string within row          if ((instr(1, search, "can", vbbinarycompare) = 1) _             , (worksheets("sheet1").cells(i, 8) = shipday) _             , (worksheets("sheet1").cells(i, 6).text = "invoice"))              number = worksheets("sheet1").cells(i, 10).value ' set order number variable              ' add variable values dynamic array          end if      next      worksheets("june canada").cells(l + 10, 8).value = ???  'enter # of unique values sheet      shipday = shipday - l  next l  end sub 

something this, might need adjusting:

' add variable values dynamic array dim foundit boolean = false x integer = 0 unique.length     if unique(x) = number         foundit = true         exit     end if next if foundit = false     unique(unique.length + 1) = number end if 

Comments

Popular posts from this blog

How to provide Authorization & Authentication using Asp.net, C#? -

toolbar - How to add link to user registration inside toobar in admin joomla 3 custom component -

How to use Authorization & Authentication in Asp.net, C#? -