Expanding a list

  • Thread starter littleredhairedgirl
  • 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
 
D

Don Guillett

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
 
D

Don Guillett

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
 
D

Don Guillett

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
 
S

Shane Devenshire

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)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top