excel - How to repeat all column values for each row in another column -


i have table has 2 columns:

height width 400    200 500    300 600    400 700 800 ... 

and need create second table next repeat entire column height each value in width column, whilst copying, every possible combination:

height width 400    200 500    200 600    200 700    200 800    200 400    300 500    300 600    300 700    300 800    300 

the simplest way think of running nested loops. might need modify code below depending on structure of sheets, should going.

sub loops()  dim n_height, n_width, c integer  thisworkbook.sheets("sheet1")  n_height = .cells(rows.count, 1).end(xlup).row 'assuming height in column n_width = .cells(rows.count, 2).end(xlup).row 'assuming width in column b  c = 2  = 2 n_height     j = 2 n_width         .range("d" & c).value = .range("a" & i).value 'prints heights in column d         .range("e" & c).value = .range("b" & j).value 'prints widths in column e         c = c + 1     next j next  end  end sub 

Comments

Popular posts from this blog

python - mat is not a numerical tuple : openCV error -

c# - MSAA finds controls UI Automation doesn't -

wordpress - .htaccess: RewriteRule: bad flag delimiters -