View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
hideki[_11_] hideki[_11_] is offline
external usenet poster
 
Posts: 1
Default Macro to list numbers


Try this. Is this is what you are looking for? Sorry if the code itself
is not vey good. I'm also a beginner.

Sub RepeatNumbers()

Dim lngLastRow As Long
Dim lngCount As Long
Dim lngRow As Long
Dim lngRepeat As Long
Dim lngRowAtC As Long
Dim lngValueAtA As Long

lngLastRow = Cells(Rows.Count, "A").End(xlUp).Row
lngRowAtC = 2
For lngRow = 2 To lngLastRow
lngValueAtA = Cells(lngRow, "A").Value
lngCount = Cells(lngRow, "B").Value
lngRepeat = 0
'lngRowAtC = lngRow - 1
If lngCount < 0 Then
Do Until lngRepeat = lngCount
Cells(lngRowAtC, "C").Value = lngValueAtA
lngRepeat = lngRepeat + 1
lngRowAtC = lngRowAtC + 1
Loop
End If
Next

End Sub


--
hideki
------------------------------------------------------------------------
hideki's Profile: http://www.excelforum.com/member.php...o&userid=18903
View this thread: http://www.excelforum.com/showthread...hreadid=397592