- ©«¤l
- 2035
- ¥DÃD
- 24
- ºëµØ
- 0
- ¿n¤À
- 2031
- ÂI¦W
- 0
- §@·~¨t²Î
- Win7
- ³nÅ骩¥»
- Office2010
- ¾\ŪÅv
- 100
- ©Ê§O
- ¨k
- µù¥U®É¶¡
- 2012-3-22
- ³Ì«áµn¿ý
- 2024-2-1
|
¦^´_ 12# chaoyiho - Sub Ex()
- Dim arr As Variant, xs As Variant
- Static tf As Boolean
-
- tf = Not tf
- arr = Array("Sav", "Exh", "J.C.W", "P.C.O", "Pmax", "Stuffing Box", "F.O.", "Liner", "Á`ªí")
-
- For Each xs In srr
- Sheets(xs).Visible = tf
- Next
- End Sub
½Æ»s¥N½X- Sub Ex2()
- Dim arr As Variant, xs As Variant
- Dim tf As Boolean
-
- arr = Array("Sav", "Exh", "J.C.W", "P.C.O", "Pmax", "Stuffing Box", "F.O.", "Liner", "Á`ªí")
- tf = 1 + Sheets(arr(0)).Visible
-
- For Each xs In srr
- Sheets(xs).Visible = tf
- Next
- End Sub
½Æ»s¥N½X Ex() »P Ex2() ¬OÄÝ©ó¨âÓ¤£¦P«Å§i¤è¦¡ªºÀ³¥Î¡G
¦ý²×¨äµ²ªG°õ¦æ§¹«á¤@¼Ë¬O¹F¦¨ ¡yªí³æÅã²{¡z¡B
¥ç©Î¡yªí³æÁôÂázªº»Ý¨D¡C
¤@¡B¡u«¬ºA«Å§i¡v¡G
Ex() ¸Ì¯S·N±N tf «Å§i¦¨¤@ÓÀRºA¥¬ªL (Static Boolean)
ÅܼơF¥ç§Y¸Ó¨ç¦¡ Ex() ¤@¸g±Ò¥Î tf §Y¬° False¡A ·í§A
±N¥¦ªºÈ§ïÅܤF¡A¨Ò¦p¡Gtf = Not tf¡A tf È«h¥Ñ False
ÅÜ§ó¬° True¡A·í¤U¤@¦¸¦A«×¶i¤J¨ì¸Ó¨ç¦¡ Ex() ¸Ì°õ¦æ®É¡A
¥¦ªºÈ¨Ì¬° True ¤£ÅÜ¡A°£«D¥¦¦A¦¸¸I¨ì tf = Not tf
ªº«·sµ¹È¡F tf ªºÈ§Y³Q×¥¿¦¨¬° False¡C
¦¹ºØ¤è¦¡¸g±`¥Î©ó¬Y¨Ç¨ç¦¡©ó°õ¦æ®É¡A»Ý¥Î¨ì¨ç¦¡
¤º³¡¨Ï¥ÎÀRºA«O¯dÈ(«D¤½¥ÎÅܼÆ)§@·~Àô¹Òªº°õ¦æ¡C³o¤]¬O
¬°¦ón±N¥¦«Å§i¦¨ÀRºA¥¬ªL (Static Boolean) Åܼƪº¹D²z¡F
¾Ç²ß°£¤Fn¯à¸Ñ¨MºÃÃøÂø¯g¥~¡AÁÙ¶·¦³¡y±o¥H«ä¦Ò¡zªºªÅ¶¡¡C
Ex2() ¸Ì±N tf «Å§i¦¨¤@Ó¥¬ªL«¬ºA (Boolean) ªºÅܼơF¥¦
¦b¨C¦¸¶i¤J Ex2() ¨ç¦¡¸Ì®É¡A¸Ó tf ªºÈ¥Ã»·¬° False È¡A
©Ò¥H§A¥²¶·¨C¦¸n¦A«·sµ¹È¡F§_«h¥¦ªºÈ¬O¬° False ªº¡F
³o¥ç¬O¤º³¡°ÊºAÅܼƪº¯S¼x (ªì©lȪºµ¹¤©)¡C
¤G¡B¡uÅܼÆȤ§µ¹È¡v¡G
Ex() ¨ç¦¡¸Ì tf = Not tf¡F
tf ¬°¤@ÀRºA¥¬ªL (Static Boolean) ÅܼơA¨ä²Ä¤@¦¸°õ¦æ±Ò°Ê
ªºªì©lȬ° False È¡A·í²Ä¤@¦¸¹J¨ì tf = Not tf ªºµ¹È¡A¥¦«h
×¥¿¬° True¡F©ó¤U¦¸¦A¦¸¶i¤J¨ì Ex() ¨ç¦¡¸Ì tf ªºÈ¨Ì¬° True
¤£ÅÜ¡A°£«D¥¦¦A¦¸¸I¨ì tf = Not tf ªº«·sµ¹È¡F tf ªºÈ©lÅܬ°
False¡C¥¦°í«Hªºì«h¬O¤£¨ü¥~¦b¨ç¦¡ªº§ïÅܦӼvÅT¨äȪº¤£·í²§°Ê¡C
Ex2() ¨ç¦¡¸Ì tf = 1 + Sheets(arr(0)).Visible¡F
¦¹³Bªº tf ªºµ¹È¡A¬O¨Ì¾Ú¶i¤J¨ì Ex2() ¨ç¦¡·í®É¸Ìªº²Ä¤@Óªí³æ
Sheets(arr(0)).Visible ¬° ¡yªí³æÅã²{¡z¡B¥ç©Î¡yªí³æÁôÂáz¦Ó¨M©w¡F
°²³]¦¹®É Sheets(arr(0)).Visible Ȭ° -1 (ªí³æÅã²{)¡A«h·í tf =
1 + Sheets(arr(0)).Visible ®É¡F¨äÈ«h×¥¿¬° 0 (ªí³æÁôÂÃ)¡F
¤Ï¤§¡B ¶i¤J¨ì Ex2() ¨ç¦¡·í®É¡A Sheets(arr(0)).Visible Ȭ° 0 ®É¡F
¸g¹L tf = 1 + Sheets(arr(0)).Visible ªº¦A«·sµ¹È¡F¨äÈ«h¤S×¥¿¬° 1
(ªí³æÅã²{)¡F
µ²½×¬O¡GµL½×§AÀ³¥Î¦óºØ«¬ºA©Î¤è¦¡¨Ó³B²z¡F³Ì«nªº¬O§AÓ¤Hªº«ä¦Ò¤è¦V¡B
»Pºc«ä¬°¦ó¡FµL©Ò¿×ªº¹ï¿ù¬O«D°ÝÃD¡A¥u¦³Ó¤H¦Ò¶qªº¨¤«×«äºû¤§ªí¹F®t²§¡C
µ{¦¡½s¼¶§Þ¥©¯à§_¦³©Ò¼W¶i¡B¬ð¯}Ó¤H«äºûªº¦º¨¤¡F¥u¦b©ó§AÓ¤Hªº¥ø¹Ï¤ß
¤ÎÓ¤H·N¹Òªº°l¨D§¹¬ü½}¤F¡C |
|