The code below is VBA for Excel. I am using the Visual Basic editor that comes with Excel 2007.
Dim counter As Integer counter = 1 While counter < 20
VBA is not VB/VB.NET
The correct reference to use is Do..Loop Statement (VBA). Also see the article Excel VBA For, Do While, and Do Until. One way to write this is:
Do While counter < 20 counter = counter + 1 Loop
(But a For..Next might be more appropriate here.)
Happy coding.