How to extract vell value by range in excel? -
i have excel sheet head in every 5th cell , cell between member of head
how can extract member of head in format :
head1,member1,member2,member3 head2,member1,member2 head3,member1,member2,member3,member4
my excel file :
head1 - - member1 member2 - - head2 member1 - member2 - - - head3 member1 - member2 member3 member4
try this:
sub extract() dim r range, textrow string, out range set r = [a1] set out = [b1] while r.value <> "" if instr(r.value, "head") > 0 if textrow <> "" out.value = textrow set out = out.offset(1) textrow = "" end if textrow = textrow & "," & r.value end if if instr(r.value, "member") > 0 textrow = textrow & "," & r.value set r = r.offset(1) loop if textrow <> "" out.value = textrow set out = out.offset(1) end if end sub
Comments
Post a Comment