Starting a vba list

Questions ArchiveCategory: ProgrammingStarting a vba list
Tim asked 2 years ago

How do you start a list in VBA. I am trying to do the HW problem where it asks to list numbers 1-25. I am getting it to show up in the immediate window but not the sheet.
Among other tries, this is my current code and it is not working but I can’t figure out what I need to do.
 
Sub dountil()
‘dim
Dim n As Integer

Set therange = Range(Range(“A1”), Range(“A1”).End(xlDown))
n = 1
Do Until n = 26
DoEvents

n = n + 1
Loop

End Sub

1 Answers
Tamilyn Hogan answered 2 years ago

Your loop looks good, just use Cells with your n value as the row parameter to set the value of a Cell(1, n) (for example) to be equal to n and that should print each number 1 – 25.

Your Answer

17 + 7 =

css.php