ÓÑÇéÌáʾ£ºÈç¹û±¾ÍøÒ³´ò¿ªÌ«Âý»òÏÔʾ²»ÍêÕû£¬Çë³¢ÊÔÊó±êÓÒ¼ü¡°Ë¢Ð¡±±¾ÍøÒ³£¡ÔĶÁ¹ý³Ì·¢ÏÖÈκδíÎóÇë¸æËßÎÒÃÇ£¬Ð»Ð»£¡£¡ ±¨¸æ´íÎó
·É¶ÁÖÐÎÄÍø ·µ»Ø±¾ÊéĿ¼ ÎÒµÄÊé¼Ü ÎÒµÄÊéÇ© TXTÈ«±¾ÏÂÔØ ½øÈëÊé°É ¼ÓÈëÊéÇ©

excel_vba_±à³Ì½Ì³Ì(ÍêÕû°æ)-µÚ20ÕÂ

°´¼üÅÌÉÏ·½Ïò¼ü ¡û »ò ¡ú ¿É¿ìËÙÉÏÏ·­Ò³£¬°´¼üÅÌÉ쵀 Enter ¼ü¿É»Øµ½±¾ÊéĿ¼ҳ£¬°´¼üÅÌÉÏ·½Ïò¼ü ¡ü ¿É»Øµ½±¾Ò³¶¥²¿£¡
¡ª¡ª¡ª¡ªÎ´ÔĶÁÍꣿ¼ÓÈëÊéÇ©ÒѱãÏ´μÌÐøÔĶÁ£¡



¡¡¡¡¡¡¡¡¡¡¡¡¡¡Range£¨¡¨C6¡¨£©¡£Select¡¡¡¡¡¡
3£®¡¡¡¡ÕÒµ½ÉèÖù«Ê½µ¥Ôª¸ñ¸ñʽµÄ´úÂ룬ÒÀÕÕÏÂÃæµÄÀý×ÓÐ޸ĴúÂ룺¡¡¡¡
¡¡¡¡¡¡¡¡¡¡¡¡¡¡'¡¡Find¡¡and¡¡format¡¡cells¡¡containing¡¡formulas¡¡¡¡¡¡
¡¡¡¡¡¡¡¡¡¡¡¡¡¡Selection¡£SpecialCells£¨xlCellTypeFormulas£»¡¡23£©¡£Select¡¡¡¡¡¡
¡¡¡¡¡¡¡¡¡¡¡¡¡¡With¡¡Selection¡£Font¡¡¡¡¡¡
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡£FontStyle¡¡=¡¡¡¨Bold¡¨¡¡¡¡¡¡
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡lorIndex¡¡=¡¡3¡¡¡¡¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡23¡¡

¡­¡¡Ò³Ãæ¡¡40¡­

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡End¡¡With¡¡¡¡¡¡
4£®¡¡¡¡ÕÒµ½ÏÂÊöÁ½ÐдúÂ룺¡¡¡¡
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡Range£¨¡¨A1£ºA3¡¨£©¡£Select¡¡¡¡¡¡
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡Selection¡£EntireRow¡£Insert¡¡¡¡
5£®¡¡¡¡ÓÃÏÂÃæµÄÒ»¾ä´úÂëÈ¡´úÉÏÃæµÄÁ½¾ä´úÂ룺¡¡¡¡
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡Range£¨¡¨A1£ºA3¡¨£©¡£EntireRow¡£Insert¡¡¡¡
×¢Ò⣬ExcelʹÓÃÁËR1C1ÐÎʽÀ´ÉèÖÃÑ¡Öе¥Ôª¸ñ¸ö¹«Ê½£º¡¡¡¡
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ActiveCell¡£FormulaR1C1¡¡=¡¡¡¨Text¡¨¡¡¡¡¡¡
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ActiveCell¡£FormulaR1C1¡¡=¡¡¡¨Numbers¡¨¡¡¡¡¡¡
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ActiveCell¡£FormulaR1C1¡¡=¡¡¡¨Formulas¡¨¡¡¡¡¡¡
ºê¼ÖÆÆ÷ʹÓÃÁËÒ»´Î¡°ActiveCell¡±ºÍÒ»´Î¡°Selection¡±À´Ñ¡Ôñµ±Ç°µ¥Ôª¸ñ¡£ÕâÁ½¸ö´Ê¶¼³ÆΪÊô¡¡
ÐÔ¡£Ä㽫ÔÚµÚ¶þÕÂÀïѧϰÊôÐÔ¡£µ±½öÓÐÒ»¸öµ¥Ôª¸ñ±»Ñ¡ÖÐʱ£¬Äã¿ÉÒÔËæÒâʹÓá°ActiveCell¡±»òÕß¡¡
¡¡¡°Selection¡±¡£¡¡¡¡

10¡¡²âÊÔÐ޸ĺõĺꡡ¡¡

µ±ÄãÐ޸ĺêµÄʱºò£¬ºÜ¿ÉÄÜ»á´øÈëһЩ´íÎó¡£ÀýÈ磬Äã¿ÉÄÜ»áɾ³ýÒ»ÐÐÖØÒªµÄ´úÂ룬»òÕß¿ÉÄܲ»×¢¡¡
ÒâÇå³ý»òºöÂÔÁËÒ»¸ö¶ºµã£¨Í£¶Ù£©¡£ÎªÁËÈ·±£ÄãµÄºêÔÚÄãÐÞ¸ÄÖ®ºó»¹ÄÜÕýÈ·µØ¹¤×÷£¬Äã±ØÐëÔËÐÐËü¡£¡¡¡¡
ÔÚVBE´°¿Ú£¬½«¹â±ê·ÅÔÚºê´úÂëWhatsInACellµÄÈÎÒâÐУ¬Ñ¡Ôñ¡°ÔËÐС±£­¡°ÔËÐÐÄ£¿é/´°Ì塱¡¡¡¡
Èç¹ûÄãÔÚÐ޸ĴúÂëµÄʱºò£¬Ã»ÓдøÈëÈκÎÎÊÌ⣬ÄÇôºê½«Ë³ÀûÔËÐУ¬¶ø²»»áÓÐÈκα¨´í¡£ÄãÐèÒªÇС¡
»»µ½Excel½çÃæÈ¡¿´ÄãµÄºêÔËÐеĽá¹û¡£Äã¿ÉÒÔµã»÷ÈÎÎñÀ¸£¬»òÕß°´Alt£«F11»Øµ½Excel½çÃæ¡£¡¡¡¡
Èç¹ûºêÔÚÔËÐеĹý³ÌÖÐÓöµ½´íÎó£¬Ä㽫»á¿´µ½Ò»¸ö¶Ô»°¿òÏÔʾ·¢ÏֵĴíÎóÀàÐÍ¡£ÔÚÄãÔËÐкêÃüÁîÖ®¡¡
Ç°£¬Äã±ØÐëÈ·±£ÄãµÄºê¿ÉÒÔÔÚµ±Ç°¼¤»îµÄ¹¤×÷±íÀïÃæÔËÐС£ÀýÈ磬Ä㵱ǰµçÄÔÉϼ¤»îµÄʱһ¸ö¿ÕµÄ¡¡
Excel¹¤×÷±í£¬ÄãÊÔͼÔËÐÐWhatsInACell£¬ÕâʱÄ㽫¿´µ½Ò»¸ö´íÎóÐÅÏ¢£º¡°ÔËÐÐʱ¼ä´íÎó¡®1004¡¯£­¡¡
ÕÒ²»µ½µ¥Ôª¸ñ¡±¡£µã»÷¡°½áÊø¡±°´Å¥£¬ÔÚÄãÖØÐÂÔËÐкê֮ǰ£¬È·±£Ñ¡ÔñÁËÕýÈ·µÄ¹¤×÷±í¡£¡¡¡¡
Èç¹ûÑ¡ÔñµÄ¹¤×÷±íÖ»º¬ÓÐÎı¾£¬ÄãÔÚÔËÐÐWhatsInACellµÄʱºò£¬VBÊÔͼѡÔñº¬ÓÐÊý×ֵĵ¥Ôª¸ñʱ»á¡¡
Óöµ½Í¬ÑùµÄ¡°ÕÒ²»µ½µ¥Ôª¸ñ¡±µÄ´íÎ󡣡¡¡¡
Èç¹ûÄãºöÂÔÁËWith¡¡Selection¡£FontÖеĶºµã£¬VB»á³öÏÖ¡°ÔËÐÐʱ¼ä´íÎó¡®424¡¯£­ÐèÒª¶ÔÏó¡±µÄÐÅ¡¡
Ï¢¡£µã»÷ÐÅÏ¢¿òÉϵġ°µ÷ÊÔ¡±°´Å¥£¬Ä㽫½øµ½´úÂë´°¿Ú¡£Í¬Ê±£¬VB»á½øÈë¡°Öжϡ±Ä£Ê½£¬²¢ÇÒ½«ÓС¡
ÎÊÌâµÄÐÐÓûÆÉ«Í»³ö³öÀ´¡£ÔÚÄã¸üÕý´úÂëºó£¬VB¿ÉÄܻᵯ³öÐÅÏ¢£º¡°Õâ¸ö²Ù×÷½«»áÖØÖÃÄãµÄ¹¤³Ì£¬¡¡
¼ÌÐø£¿¡±µã»÷È·¶¨¡£¾¡¹ÜÄã¿ÉÒÔÔÚÖжÏģʽÐ޸ĴúÂ룬µ«ÊÇ£¬ÓÐЩÐ޸ĻáÖÕÖ¹ºêµÄ¼ÌÐøÖ´ÐС£¸üÕý¡¡
ºê´úÂëºó£¬ÖØÐÂÔËÐÐËü£¬Ò²ÐíÄã»áÐèÒª½â¾ö¸ü¶àµÄ´íÎó£¬Ö®ºó²ÅÄÜ˳ÀûµØÔËÐÐËü¡£Ä㽫ÔÚµÚ¶þÕº͡¡
µÚÊ®ÈýÕÂÀïÃæѧµ½¸ü¶àµÄ¹ØÓÚÈçºÎ´¦ÀíVBA´íÎóµÄ·½·¨¡£¡¡¡¡

11¡¡Á½¸ö²ãÃæÔËÐкêµÄ·½·¨¡¡¡¡

Äã¼È¿ÉÒÔÔÚExcel½çÃæÔËÐк꣬Ҳ¿ÉÒÔÔÚVB±à¼­Æ÷½çÃæÔËÐÐËü¡£µ±Äã´ÓVB±à¼­Æ÷ÆÁĻִÐС¡
WhatsInACellʱ£¬VBÔÚÆÁĻ֮ºóÖ´ÐÐÕâЩ´úÂë¡£Äã¿´²»µ½VBÑ¡ÔñºÍÉèÖøñʽ£¬Ò²¿´²»µ½VB²åÈëÈý¿Õ¡¡
ÐÐ×öͼÀý¡£ÎªÁ˹۲쵽VBµÄÖ´ÐÐÇé¿ö£¬Äã±ØÐëÔÚExcel½çÃ棬ͨ¹ýÑ¡Ôñ¡°¹¤¾ß¡±£­¡°ºê¡±£¬»òÕß½«Äã¡¡
Excel½çÃæºÍVB±à¼­Æ÷½çÃæͬʱÏÔʾÔÚµçÄÔÆÁÄ»ÉÏ£¨²Î¼ûͼ1£­6£©¡¡¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡24¡¡

¡­¡¡Ò³Ãæ¡¡41¡­

¡¡¡¡
ͼ1£­6¡¡Èç¹ûÄã´ÓVB±à¼­Æ÷ÔËÐкêʱ£¬Ïë¹Û²ìºêµÄÔËÐÐÇé¿ö£¬Äã±ØÐ뽫Excel½çÃæºÍVB±à¼­Æ÷²¢Åŵء¡
²¼ÖÃÔÚÒ»Æð¡¡¡¡
°´ÕÕÏÂÁв½ÖèÀ´²¢ÅŲ¼ÖÃÄãµÄExcel½çÃæºÍVB±à¼­Æ÷½çÃ棺¡¡¡¡
1£®¡¡¡¡ÔÚÈÎÎñÀ¸ÉϵĿհ״¦µ¥»÷ÓÒ¼ü¡£ÈÎÎñÀ¸ÔÚÆÁÄ»µÄ϶ˣ¬¡°¿ªÊ¼¡±°´Å¥µÄλÖᣡ¡¡¡
2£®¡¡¡¡ÏÂÁв˵¥ÖУ¬Ñ¡Ôñ¡°×ÝÏòƽÆÌ´°¿Ú¡±¡¡¡¡
3£®¡¡¡¡×îС»¯ÄÇЩ²»ÐèÒªµÄ´°¿Ú£¬Öظ´²½Öè1¡¡¡¡
4£®¡¡¡¡ÏÖÔÚ£¬Á½¸ö´°¿Ú²¢ÅÅÏÔʾÁË£¬µã»÷´úÂëµÄÈÎÒâλÖã¬È»ºó°´Ï¡°F5¡±£¨»òÕßÑ¡Ôñ¡°ÔËÐС±£­¡°ÔË¡¡
¡¡¡¡¡¡¡¡¡¡ÐÐÄ£¿é/´°Ì塱£©¡£×øºÃ£¬¹Û²ìÄã¼ÖƵĺêÔÚÔËÐУ¬²»ÊǺܼ¤¶¯Âð£¿ÉÔºó£¬Ä㽫ѧϰÈçºÎ½«VBÂý¡¡
¡¡¡¡¡¡¡¡¡¡ÂýÔËÐУ¬ÕâÑùÄã¡¡¾Í¿ÉÒÔÒ»²½Ò»²½µØ¹Û²ìºê´úÂëµÄÔËÐÐÇé¿ö¡£¡¡¡¡

12¡¡ÍêÉÆÄãµÄºê´úÂë¡¡¡¡

¼Öƺêºó£¬Äã¿ÉÄܻᷢÏÖºê¿ÉÒÔ½øÐÐһЩ±ðµÄ²Ù×÷¡£Èç¹ûÄãÒѾ­ÊìϤÁËVBÓïÑÔ£¬ÒªÍùºêÀïÃæ¼ÓÖ¸Áî¡¡
²¢²»ÊÇÒ»¼þÀ§ÄѵÄÊÂÇ顣Ȼ¶ø£¬ÔÚ¾ø´ó¶àÊýÇé¿öÏ£¬Äã¿ÉÒÔ½«ÕâЩ¹¤×÷½»¸øExcelºê¼ÖÆÆ÷£¬´Ó¶ø¡¡
¸üÓÐЧµØÍê³ÉÕâÏ×÷¡£ÄãÒ²Ðí»á˵£¬Excel¼ÖÆÁËÌ«¶àµÄ²»ÐèÒªµÄÖ¸Áî¡£µ«ÊÇ£¬¿Ï¶¨µÄÊÇ£¬ºê¼¡¡
ÖÆÆ÷²»»á·¸´í£¬ÄãÍêÈ«¿ÉÒÔÒÀÀµÓÚËü¡£¡¡¡¡
Èç¹ûÄãÏëҪͨ¹ýºê¼ÖÆÆ÷ÔÚÄãµÄ´úÂëÀïÌí¼ÓÖ¸ÁÄÇôÄã±ØÐë¼ÖÆÒ»¸öк꣬Ȼºó¸´ÖÆÐèÒªµÄ²¿·Ö¡¡
ÔÙÕ³Ìùµ½Ô­À´´úÂëµÄÕýȷλÖᣡ¡¡¡
ÎÒÃÇÀ´¸øA1£ºB3Ìí¼Ó´Ö±ß¿ò£º¡¡¡¡
1£®¡¡¡¡¼¤»îͼ1£­6¿´µ½µÄExcel½çÃæ¡¡¡¡
2£®¡¡¡¡Ñ¡Ôñ¡°¹¤¾ß¡±£­¡°ºê¡±£­¡°Â¼ÖÆкꡱ¡¡¡¡
3£®¡¡¡¡ÔÚºê¶Ô»°¿òµã»÷È·¶¨£¬½ÓÊÜĬÈϵĺêÃû²¢¿ªÊ¼Â¼ÖÆ¡¡¡¡
4£®¡¡¡¡Ñ¡ÔñÇøÓòA1£ºB3¡¡¡¡
5£®¡¡¡¡Ñ¡Ôñ¡°¸ñʽ¡±£­¡°µ¥Ôª¸ñ¡±£¬µã»÷¡°±ß¿ò¡±Ò³¡¡¡¡
6£®¡¡¡¡ÔÚ¡°±ß¿òÑùʽ¡±²¿·Ö£¬µã»÷¡°Íⲿ¡±°´Å¥¡¡¡¡
7£®¡¡¡¡Ôڱ߿ò´ÖϸÁÐ±í£¬µã»÷×î´ÖµÄ£¬ÔÙµã»÷È·¶¨¹Ø±Õ¶Ô»°¿ò¡¡¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡25¡¡

¡­¡¡Ò³Ãæ¡¡42¡­

8£®¡¡¡¡µã»÷µ¥Ôª¸ñA1¡£×¢Ò⣬A1£ºB3ÇøÓòÓÐÁ˴ֱ߿ò¡£¡¡¡¡
9£®¡¡¡¡µã»÷¡°Í£Ö¹Â¼ÖÆ¡±°´Å¥£¬»òÕßÑ¡Ôñ¡°¹¤¾ß¡±£­¡°ºê¡±£­¡°Í£Ö¹Â¼ÖÆ¡±¡¡¡¡
Çл»ÖÃVB±à¼­Æ÷´°¿Ú£¬²é¿´Äã¼ÖƵĺꡣ¸øA1£ºB3£¨ÒëÕߣºÔ­ÎÄΪA1£ºA3£©Ìí¼Ó´Ö±ß¿òµÄ´úÂëÈçÏ£º¡¡¡¡
¡¡¡¡¡¡¡¡¡¡¡¡¡¡Sub¡¡Macro2£¨£©¡¡¡¡¡¡
¡¡¡¡¡¡¡¡¡¡¡¡¡¡'¡¡¡¡¡¡
¡¡¡¡¡¡¡¡¡¡¡¡¡¡'¡¡Macro2¡¡Macro¡¡¡¡¡¡
¡¡¡¡¡¡¡¡¡¡¡¡¡¡'¡¡Macro¡¡recorded¡¡5/31/2002¡¡by¡¡Julitta¡¡Korol¡¡¡¡¡¡
¡¡¡¡¡¡¡¡¡¡¡¡¡¡'¡¡¡¡¡¡
¡¡¡¡¡¡¡¡¡¡¡¡¡¡'¡¡¡¡¡¡
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡Range£¨¡¨A1£ºB3¡¨£©¡£Select¡¡¡¡¡¡
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡Selection¡£Borders£¨xlDiagonalDown£©¡£LineStyle¡¡=¡¡xlNone¡¡¡¡¡¡
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡Selection¡£Borders£¨xlDiagonalUp£©¡£LineStyle¡¡=¡¡xlNone¡¡¡¡¡¡
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡With¡¡Selection¡£Borders£¨xlEdgeLeft£©¡¡¡¡¡¡
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡£LineStyle¡¡=¡¡xlContinuous¡¡¡¡¡¡
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡£Weight¡¡=¡¡xlThick¡¡¡¡¡¡
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡lorIndex¡¡=¡¡xlAutomatic¡¡¡¡¡¡
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡End¡¡With¡¡¡¡¡¡
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡With¡¡Selection¡£Borders£¨xlEdgeTop£©¡¡¡¡¡¡
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡£LineStyle¡¡=¡¡xlContinuous¡¡¡¡¡¡
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡£Weight¡¡=¡¡xlThick¡¡¡¡¡¡
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡lorIndex¡¡=¡¡xlAutomatic¡¡¡¡¡¡
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡End¡¡With¡¡¡¡¡¡
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡With¡¡Selection¡£Borders£¨xlEdgeBottom£©¡¡¡¡¡¡
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡£LineStyle¡¡=¡¡xlContinuous¡¡¡¡¡¡
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡£Weight¡¡=¡¡xlThick¡¡¡¡¡¡
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡lorIndex¡¡=¡¡xlAutomatic¡¡¡¡¡¡
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡End¡¡With¡¡¡¡¡¡
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡With¡¡Selection¡£Borders£¨xlEdgeRight£©¡¡¡¡¡¡
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡£LineStyle¡¡=¡¡xlContinuous¡¡¡¡¡¡
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡£Weight¡¡=¡¡xlThick¡¡¡¡¡¡
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡lorIndex¡¡=¡¡xlAutomatic¡¡¡¡¡¡
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡End¡¡With¡¡¡¡¡¡
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡Selection¡£Borders£¨xlInsideVertical£©¡£LineStyle¡¡=¡¡xlNone¡¡¡¡¡¡
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡Selection¡£Borders£¨xlInsideHorizontal£©¡£LineStyle¡¡=¡¡xlNone¡¡¡¡¡¡
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡Range£¨¡¨A1¡¨£©¡£Select¡¡¡¡¡¡
¡¡¡¡¡¡¡¡¡¡¡¡¡¡End¡¡Sub¡¡¡¡¡¡
ÏÖÔÚ£¬ÎÒÃÇÀ´·ÖÎöÒ»ÏÂÕâЩ¼ÖƵĴúÂë¡£ÄãÈÏΪÄã¿ÉÒÔÈ¥µôÆäÖеÄһЩָÁîÂð£¿ÔÚÄãɾ³ýÕâЩ²»±Ø¡¡
ÒªµÄ´úÂë֮ǰ£¬¿¼ÂÇʹÓÃ×¢ÊÍ¡£ÔÚÄãɾ³ýÈκδúÂë֮ǰ£¬Ç뽫ËüÃÇ×¢Ê͵ô£¬È»ºóÔËÐкꡣÈç¹ûVB¡¡
ûÓгöÏÖÈκδíÎóÐÅÏ¢£¬ÄÇôÄã¾Í¿ÉÒÔ°²È«µØɾ³ýÕâЩ±»×¢ÊÍÁ˵ĴúÂë¡£Èç¹ûÿ´Î¶¼°´ÕÕÕâ¸öÖ¸µ¼¡¡
˼Ï룬Äã¾Í²»»áÖظ´Â¼ÖÆÏàͬµÄ²Ù×÷ÁË¡£Èç¹ûÕâ¸öºêÃüÁîûÓÐÕýÈ·µØÔËÐУ¬ÄÇôÄãÐèҪȥµô¸Õ²ÅµÄ¡¡
×¢ÊÍ£¬±Ï¾¹£¬ÕâЩ´úÂë¿ÉÄÜÊDZØÐëµÄ¡£¹ØÓÚ×¢Ê͵ÄÏêϸÐÅÏ¢£¬²Î¼ûµÚ¶þÕ¡£¡¡¡¡
µ±ÄãʹÓúê¼ÖÆÆ÷À´´´½¨ºêµÄʱºò£¬Äã¿ÉÒԺܿìµØÕÆÎÕExcel²Ëµ¥Ñ¡ÏîºÍ¶Ô»°¿òÉèÖÃÔÚVBAÀïµÄµÈͬ¡¡
·½·¨¡£È»ºó£¬Äã¿ÉÒÔÔÚÔÚÏß°ïÖúÀïÃæ²éÕÒÕâЩVBÖ¸ÁîµÄÒâ˼ºÍÓ÷¨¡£ºÜÏÔÈ»£¬VBÒªÖ´ÐÐÔ½¶àµÄÖ¸Á¡¡
ºêÔËÐеÄËٶȾÍÔ½Âý¡£È¥µôÄÇЩÎ޹ؽôÒªµÄÃüÁî»á¼ÓËÙºêµÄÔËÐС£È»¶ø£¬ÎªÁËʹÄãµÄ´úÂëÈÝÒ×Àí½â£¬¡¡
ÄãÐèÒª´÷ÉÏÄãµÄÕì̽ñ×Ó£¬Ñ°Çó×î¼Ñ;¾¶¡£ÀýÈ磬¿´Ò»ÏÂÄã¼ÖƵĸøÑ¡Öеĵ¥Ôª¸ñ¼ÓÍâ¿òµÄºê¡£¿´¡¡
ÉÏÈ¥£¬ºê¼ÖÆÆ÷ÊÇÔÚ·Ö±ðµØ¸øÿһÌõÏß½øÐÐÉèÖá£VBûÓÐÒ»¸ö¼òµ¥µÄÒ»¾äÃüÁîÀ´¸øÑ¡ÖеÄÇøÓò¼ÓÍâ¡¡
±ß¿ò£¬ÕâËƺõºÜÄÑÀí½â¡£Ñ§Ï°ÈκÎÓïÑÔÖÐÕýÈ·µÄ´ÊÓïºÍ±í´ïÊǺܷÑʱµÄ¡£Ê±¼äÒ»³¤£¬Äã»á·¢ÏÖVB¡¡
ʵ¼ÊÉÏÓÐÒ»¸öÁíÍâµÄ·½·¨BorderAroundÈÃÄãÔÚµ¥Ôª¸ñÇøÓòÌí¼Ó±ß¿òºÍÉèÖÃÑÕÉ«£¬ÏßÐͺÍб߿òµÄ´Ö¡¡
ϸ¡£ÏÂÃæµÄÓï¾äÊÇVBAÖиøÑ¡Öеĵ¥Ôª¸ñÉèÖÃÍâΧ´Ö±ß¿òµÄ×î¼Ñ·½·¨£º¡¡¡¡
¡¡¡¡¡¡¡¡Range£¨¡¨A1£ºB3¡¨£©¡£BorderAround¡¡Weight£º=xlThick¡¡¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡26¡¡

¡­¡¡Ò³Ãæ¡¡43¡­

ÉÏÃæµÄÖ¸ÁîʹÓÃRange¶ÔÏóµÄBorderAround·½·¨¡£Ëü¸øA1£ºB3ÇøÓòÌí¼ÓÁËÒ»¸ö´ÖÏßÍâ¿ò¡££¨ÏÂÒ»Õº­¡¡
¸ÇÁËVB¶ÔÏó£¬ÊôÐԺͷ½·¨£©¡£¡¡¡¡
ÏÖÔÚÎÒÃǽ«ÉÏÃæµÄÖ¸Áî¼Óµ½ºêWhatsInACellÀïÃæÈ
·µ»ØĿ¼ ÉÏÒ»Ò³ ÏÂÒ»Ò³ »Øµ½¶¥²¿ ÔÞ£¨1£© ²È£¨1£©
δÔĶÁÍꣿ¼ÓÈëÊéÇ©ÒѱãÏ´μÌÐøÔĶÁ£¡
ÎÂÜ°Ìáʾ£º ο´Ð¡ËµµÄͬʱ·¢±íÆÀÂÛ£¬Ëµ³ö×Ô¼ºµÄ¿´·¨ºÍÆäËüС»ï°éÃÇ·ÖÏíÒ²²»´íŶ£¡·¢±íÊéÆÀ»¹¿ÉÒÔ»ñµÃ»ý·ÖºÍ¾­Ñé½±Àø£¬ÈÏÕæдԭ´´ÊéÆÀ ±»²ÉÄÉΪ¾«ÆÀ¿ÉÒÔ»ñµÃ´óÁ¿½ð±Ò¡¢»ý·ÖºÍ¾­Ñé½±ÀøŶ£¡