Commenting out Rows in VB

M

MC82

If im not wrong there is a way to comment out a selection in VB with
some key storke. what is that keystorke?
 
G

Gord Dibben

Ordinary old apostrophe does the trick

Sub text()
' this line will not be executed
this line will be executed
End Sub


Gord Dibben MS Excel MVP
 
M

Mark Lincoln

Anything after an apostrophe on a line is considered a comment.

For instance:

' This is a comment

A = B ' Comment starts here
 
M

MC82

I thought there was a key stroke to comment out selected code.

Ie. If I highlight rows 1-5, then press some keystroke. Rows 1-5 will
automatically have a ' infront of it.

I guess I might be wrong, but I could have sworn I saw a ex-coworker do
it.
 
N

Niek Otten

There is a button in the Edit toolbar (which of course you can include in
your standard toolbar) that does just that
 
M

MC82

Thanks thats exactly what I was looking for, just wished I could find
out the keystroke, but that works for now. Thanks a bunch
 
Top