bmbalamurali
New Member
- Joined
- Oct 3, 2013
- Messages
- 6
Hello Experts,
I was trying to do a task as described below in VBA (complete confusions in array and looping as per my logic), could you please help with a VBA code.
example:
The first row is column heading
1. Sheet have 10 columns, each has filled rows but not equally.
2. Need to fill all the blank rows having 7 as the limit in all columns ( because 7 is highest row count in column1 comparing all columns)
3. The blanks in each column to filled by repeating the value in top to bottom order until reaching the limit row
Before:
[TABLE="class: grid, width: 500, align: center"]
<tbody>[TR]
[TD]players[/TD]
[TD]ground[/TD]
[TD]ball[/TD]
[TD]camera[/TD]
[TD]grass[/TD]
[TD]t-shirt[/TD]
[TD]boots[/TD]
[TD]drinks[/TD]
[TD]refree[/TD]
[TD]cup[/TD]
[/TR]
[TR]
[TD]cena[/TD]
[TD]grass[/TD]
[TD]leather[/TD]
[TD]dslr[/TD]
[TD]green[/TD]
[TD]neck[/TD]
[TD]nike[/TD]
[TD]coke[/TD]
[TD]somebody[/TD]
[TD]world[/TD]
[/TR]
[TR]
[TD]messi[/TD]
[TD]mud[/TD]
[TD]plastic[/TD]
[TD]cannon[/TD]
[TD]white[/TD]
[TD]collar[/TD]
[TD]reebok[/TD]
[TD]pepsi[/TD]
[TD]nobody[/TD]
[TD]europa[/TD]
[/TR]
[TR]
[TD]ronaldo[/TD]
[TD][/TD]
[TD]sponge[/TD]
[TD]nikon[/TD]
[TD][/TD]
[TD]red[/TD]
[TD][/TD]
[TD]tea[/TD]
[TD]anybody[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]dravid[/TD]
[TD][/TD]
[TD]rubber[/TD]
[TD][/TD]
[TD][/TD]
[TD]blue[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]bolt[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]halfsleeves[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]bala[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
After: expected result
[TABLE="width: 924"]
<colgroup><col><col><col><col><col><col><col><col><col><col></colgroup><tbody>[TR]
[TD]players[/TD]
[TD]ground[/TD]
[TD]ball[/TD]
[TD]camera[/TD]
[TD]grass[/TD]
[TD]t-shirt[/TD]
[TD]boots[/TD]
[TD]drinks[/TD]
[TD]refree[/TD]
[TD]cup[/TD]
[/TR]
[TR]
[TD]cena[/TD]
[TD]grass[/TD]
[TD]leather[/TD]
[TD]dslr[/TD]
[TD]green[/TD]
[TD]neck[/TD]
[TD]nike[/TD]
[TD]coke[/TD]
[TD]somebody[/TD]
[TD]world[/TD]
[/TR]
[TR]
[TD]messi[/TD]
[TD]mud[/TD]
[TD]plastic[/TD]
[TD]cannon[/TD]
[TD]white[/TD]
[TD]collar[/TD]
[TD]reebok[/TD]
[TD]pepsi[/TD]
[TD]nobody[/TD]
[TD]europa[/TD]
[/TR]
[TR]
[TD]ronaldo[/TD]
[TD]grass[/TD]
[TD]sponge[/TD]
[TD]nikon[/TD]
[TD]green[/TD]
[TD]red[/TD]
[TD]nike[/TD]
[TD]tea[/TD]
[TD]anybody[/TD]
[TD]world[/TD]
[/TR]
[TR]
[TD]dravid[/TD]
[TD]mud[/TD]
[TD]rubber[/TD]
[TD]dslr[/TD]
[TD]white[/TD]
[TD]blue[/TD]
[TD]reebok[/TD]
[TD]coke[/TD]
[TD]somebody[/TD]
[TD]europa[/TD]
[/TR]
[TR]
[TD]bolt[/TD]
[TD]grass[/TD]
[TD]leather[/TD]
[TD]cannon[/TD]
[TD]green[/TD]
[TD]halfsleeves[/TD]
[TD]nike[/TD]
[TD]pepsi[/TD]
[TD]nobody[/TD]
[TD]world[/TD]
[/TR]
[TR]
[TD]bala[/TD]
[TD]mud[/TD]
[TD]plastic[/TD]
[TD]nikon[/TD]
[TD]white[/TD]
[TD]neck[/TD]
[TD]reebok[/TD]
[TD]tea[/TD]
[TD]anybody[/TD]
[TD]europa[/TD]
[/TR]
[TR]
[TD]cena[/TD]
[TD]grass[/TD]
[TD]sponge[/TD]
[TD]dslr[/TD]
[TD]green[/TD]
[TD]collar[/TD]
[TD]nike[/TD]
[TD]coke[/TD]
[TD]somebody[/TD]
[TD]world[/TD]
[/TR]
</tbody>[/TABLE]
hope i put my question understandable? please do come back for any clarification.
I was trying to do a task as described below in VBA (complete confusions in array and looping as per my logic), could you please help with a VBA code.
example:
The first row is column heading
1. Sheet have 10 columns, each has filled rows but not equally.
2. Need to fill all the blank rows having 7 as the limit in all columns ( because 7 is highest row count in column1 comparing all columns)
3. The blanks in each column to filled by repeating the value in top to bottom order until reaching the limit row
Before:
[TABLE="class: grid, width: 500, align: center"]
<tbody>[TR]
[TD]players[/TD]
[TD]ground[/TD]
[TD]ball[/TD]
[TD]camera[/TD]
[TD]grass[/TD]
[TD]t-shirt[/TD]
[TD]boots[/TD]
[TD]drinks[/TD]
[TD]refree[/TD]
[TD]cup[/TD]
[/TR]
[TR]
[TD]cena[/TD]
[TD]grass[/TD]
[TD]leather[/TD]
[TD]dslr[/TD]
[TD]green[/TD]
[TD]neck[/TD]
[TD]nike[/TD]
[TD]coke[/TD]
[TD]somebody[/TD]
[TD]world[/TD]
[/TR]
[TR]
[TD]messi[/TD]
[TD]mud[/TD]
[TD]plastic[/TD]
[TD]cannon[/TD]
[TD]white[/TD]
[TD]collar[/TD]
[TD]reebok[/TD]
[TD]pepsi[/TD]
[TD]nobody[/TD]
[TD]europa[/TD]
[/TR]
[TR]
[TD]ronaldo[/TD]
[TD][/TD]
[TD]sponge[/TD]
[TD]nikon[/TD]
[TD][/TD]
[TD]red[/TD]
[TD][/TD]
[TD]tea[/TD]
[TD]anybody[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]dravid[/TD]
[TD][/TD]
[TD]rubber[/TD]
[TD][/TD]
[TD][/TD]
[TD]blue[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]bolt[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]halfsleeves[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]bala[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
After: expected result
[TABLE="width: 924"]
<colgroup><col><col><col><col><col><col><col><col><col><col></colgroup><tbody>[TR]
[TD]players[/TD]
[TD]ground[/TD]
[TD]ball[/TD]
[TD]camera[/TD]
[TD]grass[/TD]
[TD]t-shirt[/TD]
[TD]boots[/TD]
[TD]drinks[/TD]
[TD]refree[/TD]
[TD]cup[/TD]
[/TR]
[TR]
[TD]cena[/TD]
[TD]grass[/TD]
[TD]leather[/TD]
[TD]dslr[/TD]
[TD]green[/TD]
[TD]neck[/TD]
[TD]nike[/TD]
[TD]coke[/TD]
[TD]somebody[/TD]
[TD]world[/TD]
[/TR]
[TR]
[TD]messi[/TD]
[TD]mud[/TD]
[TD]plastic[/TD]
[TD]cannon[/TD]
[TD]white[/TD]
[TD]collar[/TD]
[TD]reebok[/TD]
[TD]pepsi[/TD]
[TD]nobody[/TD]
[TD]europa[/TD]
[/TR]
[TR]
[TD]ronaldo[/TD]
[TD]grass[/TD]
[TD]sponge[/TD]
[TD]nikon[/TD]
[TD]green[/TD]
[TD]red[/TD]
[TD]nike[/TD]
[TD]tea[/TD]
[TD]anybody[/TD]
[TD]world[/TD]
[/TR]
[TR]
[TD]dravid[/TD]
[TD]mud[/TD]
[TD]rubber[/TD]
[TD]dslr[/TD]
[TD]white[/TD]
[TD]blue[/TD]
[TD]reebok[/TD]
[TD]coke[/TD]
[TD]somebody[/TD]
[TD]europa[/TD]
[/TR]
[TR]
[TD]bolt[/TD]
[TD]grass[/TD]
[TD]leather[/TD]
[TD]cannon[/TD]
[TD]green[/TD]
[TD]halfsleeves[/TD]
[TD]nike[/TD]
[TD]pepsi[/TD]
[TD]nobody[/TD]
[TD]world[/TD]
[/TR]
[TR]
[TD]bala[/TD]
[TD]mud[/TD]
[TD]plastic[/TD]
[TD]nikon[/TD]
[TD]white[/TD]
[TD]neck[/TD]
[TD]reebok[/TD]
[TD]tea[/TD]
[TD]anybody[/TD]
[TD]europa[/TD]
[/TR]
[TR]
[TD]cena[/TD]
[TD]grass[/TD]
[TD]sponge[/TD]
[TD]dslr[/TD]
[TD]green[/TD]
[TD]collar[/TD]
[TD]nike[/TD]
[TD]coke[/TD]
[TD]somebody[/TD]
[TD]world[/TD]
[/TR]
</tbody>[/TABLE]
hope i put my question understandable? please do come back for any clarification.