ªð¦^¦Cªí ¤W¤@¥DÃD µo©«

[¤À¨É] ¨Ï¥Î SpecialCells ¤èªkªº°g«ä

[¤À¨É] ¨Ï¥Î SpecialCells ¤èªkªº°g«ä

¥»©«³Ì«á¥Ñ GBKEE ©ó 2011-11-21 12:01 ½s¿è

¦p«ü©wªº½d³ò¤¤ªºÀx¦s®æ¦³ÁôÂÃ®É ¦¹®É¨Ï¥Î¨ìSpecialCellsªº¤èªk
´N·|IJ°Ê¨ì¤u§@ªíªºWorksheet_SelectionChange
ThisWorkbook ªº Workbook_SheetSelectionChange ¨âµ{§Ç
¨Ï¥Î°Ñ¼Æ xlCellTypeLastCell  
¥Ã»·¬O¶Ç¦^  UsedRange ªº½d³ò¤¤³Ì«á¤@­Ó Cell,  §AµLªk¶Ç¦^ ¦b¤@«ü©w ªº½d³ò¤¤³Ì«á¤@­Ó Cell
  1. Sub Ex()
  2.     With ActiveSheet
  3.        .[A15] = "TEST"
  4.        .[H1] = "TEST"
  5.         MsgBox .[A:A].SpecialCells(xlCellTypeLastCell).Address
  6.         MsgBox .UsedRange.SpecialCells(xlCellTypeLastCell).Address
  7.         .[A15] = ""
  8.         .[A10] = "TEST"
  9.         MsgBox .[A:A].SpecialCells(xlCellTypeLastCell).Address
  10.         MsgBox .UsedRange.SpecialCells(xlCellTypeLastCell).Address
  11.    End With
  12. End Sub
½Æ»s¥N½X

²Ä¤@¦¸发现这个问题,谢谢!

TOP

¸Õ¤F¤@¤U¡AªGµM¦p¦¹
­É¿ú¤£ÁÙ¡A¤~¬O¤ý¹D

TOP

"¨Ï¥Î°Ñ¼Æ xlCellTypeLastCell ¥Ã»·¬O¶Ç¦^  UsedRange ªº½d³ò¤¤³Ì«á¤@­Ó Cell"
°£¤F³o­Ó¶·­n¯S§Oª`·N¤§¥~¡A

.[A:A].SpecialCells(xlCellTypeLastCell).Address
.UsedRange.SpecialCells(xlCellTypeLastCell).Address
¤W­±¨â±ø¯uªº¬O«Ü¤Ö·|¥h·Q¨ì·|¦³®t§O¡C
­è¬Ý¨ìÁÙ·Q¥b¤Ñ¡A«ç»ò±o¨ìªº­È·|¦³®t¡C
­ì¨Ó¨âªÌªºUsedRange¬O¥Ñ¤£¦Pªº¤è¦¡©w¸q¥X¨Óªº¡C

TOP

        ÀR«ä¦Û¦b : ¶¢¤HµL¼Ö½ì¡A¦£¤HµL¬O«D¡C
ªð¦^¦Cªí ¤W¤@¥DÃD