Expanding a list

  • Thread starter Thread starter littleredhairedgirl
  • Start date Start date
L

littleredhairedgirl

I have a list of words in column A and a number in column B.

On a new sheet I would like to take the word and repeat it across
columns the number of time in column B (in the 1st Sheet)

so that

word 3
list 4
only 2

would be

word word word
list list list list list
only only
 
Sub reptacross()
With Sheets("sheet1")
For i = 1 To .Cells(Rows.Count, "a").End(xlUp).Row
Sheets("sheet2").Cells(i, "a") _
..Resize(, .Cells(i, "b")) = .Cells(i, "a")
Next i
End With
End Sub
 
I don't know about the smart part.

--
Don Guillett
Microsoft MVP Excel
SalesAid Software
(e-mail address removed)
littleredhairedgirl said:
Thanks Don
You are SexySmart
 
BTW, I had red hair when I was younger.

--
Don Guillett
Microsoft MVP Excel
SalesAid Software
(e-mail address removed)
littleredhairedgirl said:
Thanks Don
You are SexySmart
 
Hi,

You can use the following formula approach:
=IF(COLUMN()>Sheet2!$B1,"",Sheet2!$A1)
Enter this in A1 of the sheet where you want the results and copy it down
and over as far as you like. If the first formula is not goint to be in A1,
say C2, then modify the formula
=IF(COLUMN()-2>Sheet2!$B1,"",Sheet2!$A1)
 
Back
Top