ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Shortcut way for indicating comments in block of code. (https://www.excelbanter.com/excel-programming/306429-shortcut-way-indicating-comments-block-code.html)

Hari[_3_]

Shortcut way for indicating comments in block of code.
 
Hi,

Sometimes I dont want to execute a long piece of code, lets say 15 to 20
lines of code in one block but I would like to execute rest of the code.

I will have to enter the comment indicator at the beginning of each of those
lines. Rather than doing that is there a shortcut way for treating only that
particular block of code as comment?

Regards,
Hari
India



JulieD

Shortcut way for indicating comments in block of code.
 
Hi Hari

not sure if this is the easiest way but on the EDIT toolbar in VBA is an
icon to add the comment ' and one to remove it ... so select the block of
code, click on the add comment block icon (i always click 3 times to
distiguish between this & normal comments) and then when you want it to run
again, select it and click on the remove comment icon the appropriate number
of times.

Cheers
JulieD


"Hari" wrote in message
...
Hi,

Sometimes I dont want to execute a long piece of code, lets say 15 to 20
lines of code in one block but I would like to execute rest of the code.

I will have to enter the comment indicator at the beginning of each of

those
lines. Rather than doing that is there a shortcut way for treating only

that
particular block of code as comment?

Regards,
Hari
India





Rob Bovey

Shortcut way for indicating comments in block of code.
 
"Hari" wrote in message
...
Sometimes I dont want to execute a long piece of code, lets say 15 to 20
lines of code in one block but I would like to execute rest of the code.

I will have to enter the comment indicator at the beginning of each of

those
lines. Rather than doing that is there a shortcut way for treating only

that
particular block of code as comment?


Hi Hari,

If you display the Edit toolbar in the Visual Basic Editor you will see
two toolbar buttons on it called "Comment Block" and "Uncomment Block". If
you highlight a block of code and click the Comment Block button, that whole
block of code will be commented out. When you want to run that block of code
again, highlight it and click the Uncomment Block button to remove the
comments.

--
Rob Bovey, MCSE, MCSD, Excel MVP
Application Professionals
http://www.appspro.com/

* Please post all replies to this newsgroup *
* I delete all unsolicited e-mail responses *




Hari[_3_]

Shortcut way for indicating comments in block of code.
 
Hi JulieD and Rob,

Thnx a lot for ur kind help.

(One doubt, the feature u indicated is there on my toolbar but Im not able
to find it in edit. I have excel 2002. Is this not part of menu in 2002.)

Regards,
Hari
India



JulieD

Shortcut way for indicating comments in block of code.
 
Hi Hari

no, its only on the Edit Toolbar (view / toolbars / edit) not on the menu
anywhere (AFAIK).

Cheers
JulieD

"Hari" wrote in message
...
Hi JulieD and Rob,

Thnx a lot for ur kind help.

(One doubt, the feature u indicated is there on my toolbar but Im not able
to find it in edit. I have excel 2002. Is this not part of menu in 2002.)

Regards,
Hari
India





Debra Dalgleish

Shortcut way for indicating comments in block of code.
 
It's not on the Edit Menu, but you could customize your menu, and add it
(ToolsCustomize)

Hari wrote:
(One doubt, the feature u indicated is there on my toolbar but Im not able
to find it in edit. I have excel 2002. Is this not part of menu in 2002.)


--
Debra Dalgleish
Excel FAQ, Tips & Book List
http://www.contextures.com/tiptech.html



All times are GMT +1. The time now is 11:22 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com