foreach my $row (1..222){ foreach my $col (1..5){ if ($col =~ '1' && $account !~ $Sheet->Cells($row,$col)->{'Value'}){ $account = $Sheet->Cells($row,$col)->{'Value'}; @labels[$count] = $main->AddLabel( -text => $account, -top => $top, -left => $left ); $top += 15; @comboboxes[$count] = $main->AddCombobox( -name => $account."ComboBox", -top => $top, -left => $left, -width => 125, -height => 150, -tabstop => 1, -style => WS_VISIBLE | 3 | WS_VSCROLL ); $count += 1; $top += 25; } else { if ($col =~ '2'){ $value = $Sheet->Cells($row,$col)->{'Value'}; @comboboxes[$count-1]->InsertItem($value); } } } }