Re: Macro to list numbers

Tech-Archive recommends: Fix windows errors by optimizing your registry



This worked in xl2K -

Dim lrw As Long, x As Integer, cel As Range, rw As Long

lrw = Cells(Rows.Count, "A").End(xlUp).Row

For Each cel In Range("A1:A" & lrw)
If cel.Offset(0, 1) > 0 Then
rw = WorksheetFunction.CountA(Columns(3)) + 1
For x = rw To rw + cel.Offset(0, 1) - 1
Cells(x, 3) = cel
Next
End If
Next


--
steveB

Remove "AYN" from email to respond
"tryer" <tryer.1u4lym_1124647542.5775@xxxxxxxxxxxxxxxxxxxxx> wrote in
message news:tryer.1u4lym_1124647542.5775@xxxxxxxxxxxxxxxxxxxxxxxx
>
> I have a column of numbers say 1 to 10 in column A
> In column B at various rows there could be a number. This is the number
> of times I need the number in column A repeated in column C eg.
> A B C
> 1 3
> 2 3
> 3 3 3
> 4 2 4
> 5 2 4
> 6 1 5
> 7 5
> 8 6
> 9 10
> 10 1
> I have been trying to write a macro for this. I have got as far as
> going down column A and identifying how many rows are populated and
> then got stuck.
> Help would be appreciated
>
>
> --
> tryer
> ------------------------------------------------------------------------
> tryer's Profile:
> http://www.excelforum.com/member.php?action=getinfo&userid=16546
> View this thread: http://www.excelforum.com/showthread.php?threadid=397591
>


.


Quantcast