Function that returns a formatted array in VBA -


i have function prints excel data text file in array format following:

[ ['id', 'label', 'longitude', 'latitude', 'country', 'region', 'ttl_wt_flw_thru', 'sum-of-bol-wt', 'count of wdr_ref', 'ratio'], ['aeauh', 'abu dhabi, united arab emirates', 54.3666667, 24.4666667, 'ae', 'eame', 66, 30, 8432, 281.066666666667], ['aedxb', 'dubai, united arab emirates', 55.307485, 25.271139, 'ae', 'eame', 682, 3, 8369, 2789.66666666667] ] 

my code writing array is:

function fillsourcearray()     dim long, j long, s string     dim lastrow double     dim s1 string      'opens file     filepath = filepath & "dataarray" & ".txt"     open filepath output #1     'read source data     dataarray = sheets("nodes").cells(1).currentregion.value     'determine lastrow     lastrow = sheets("nodes").range("a999999").end(xlup).row     print #1, "["     'this "for" loop reads data in excel sheet string     = 2 ubound(dataarray)         s = "["         j = 1 ubound(dataarray, 2)             if isnumeric(dataarray(i, j))                 s = s & dataarray(i, j) & ", "             else                 s = s & "'" & dataarray(i, j) & "', "             end if         next         if = lastrow             print #1, replace(s & "]", ", ]", "]")         else             print #1, replace(s & "]", ", ]", "],")         end if     next      print #1, "]"     close #1 

my task: want read data in excel sheet , form array (in format shown above) , return array function fillsourcearray().

i need call function module, want print array in format.


Comments

  1. Hi Admin,

    The article is about the functioned that returns a formatted array in VBA.

    Regards,

    Dentist In Chicopee

    ReplyDelete

Post a Comment

Popular posts from this blog

css - Which browser returns the correct result for getBoundingClientRect of an SVG element? -

gcc - Calling fftR4() in c from assembly -