I had no idea this existed.
Sub testsemicolon()
Dim i As Long
For i = 1 To 5
Debug.Print i
Next i
For i = 1 To 5
Debug.Print i;
Next i
End Sub
It’s right there in the help for the Print # Statement, but I’ve never paid attention to it.
It makes two! I also didn’t knew that this was possible! Learning everyday… :)
Now that’s a nice tidbit of information. May be help is help after all.
Interesting. I frequently write text to ASCII files and this could be handy. Although I do like format control one has by building a text string and printing the single item to a line.
It’s been part of BASIC’s PRINT statement since the original version at Dartmouth College in the mid 1960s.
I’m not sure how I’ll use this, but I’m definitely pleased to have learned it. Thanks!
The comma works too.
If you are using it, it’s good practice to follow the loop with a simple Debug.Print…
Mpemba
I too had no idea that was there. Very cool.
We learn something every day.
@Mpemba –
Yes, commas work too, just as the origial BASIC manual from 1965 says they do. Cudos to MSFT for not changing this, er, basic functionality.
I used them as a schoolboy in the mid 70s when I started programming in BASIC; and in recent years in VBA.
I am guessing that you never used the Tab or Spc functions then. I am pretty sure suppressing the newline by using a semi-colon was originally introduced (oh so many years ago now) so that one could chain together data along with the crude formatting capabilities offered by the Tab and Spc functions when printing to a file.
QBASIC had PRINT USING, and I believe I recall BASICA did too, but I don’t believe VBA ever did. PRINT USING was what one used to format printed output in the dark ages of BASIC.
Quibble: VBA’s print zones are 14 chars while original DTSS BASIC print zones were 15 chars.
As others haves stated, this has been part of BASIC. So I’m just shocked people are discovering this now. ;-)