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

[µo°Ý] ª«¥ó¥i¥H©I¥sÄݩʦA©I¥sª«¥ó¶Ü

[µo°Ý] ª«¥ó¥i¥H©I¥sÄݩʦA©I¥sª«¥ó¶Ü

§Ú·Q°Ý¤U­±³o¤@¦æ
Sheets("sheet1").UsedRange.Rows.Count

Sheetsª«¥ó ©I¥s UsedRange ÄÝ©Ê

«á­±ªºRows  ¬O UsedRange ªºÄÝ©Ê¶Ü ?
UsedRange ¬OÄݩʦP®É¤]¬Oª«¥ó?
ÁÙ¬O¥¦¤]¬O Sheets ªºÄÝ©Ê ?

Excel VBA ¥i¥H¬O¥H¤U³o¼Ë¶Ü ?
ª«¥ó.ÄÝ©Ê.ª«¥ó.ÄÝ©Ê

¥»©«³Ì«á¥Ñ stillfish00 ©ó 2015-3-25 09:59 ½s¿è

¦^´_ 1# pigexcel2992
F1 Excel »¡©ú¤å¥ó
  1. Excel ¶}µo¤H­û°Ñ¦Ò¸ê®Æ
  2. Worksheet.UsedRange ÄÝ©Ê
  3. ·|¶Ç¦^ Range ª«¥ó¡A¦¹ª«¥ó¥Nªí«ü©w¤u§@ªí¤Wªº¤w¥Î½d³ò¡C°ßŪªº¡C
½Æ»s¥N½X
UsedRange ¬OÄݩʦP®É¤]¬Oª«¥ó?
¥i¥H³o»ò»¡¡AUsedRange¬OWorksheetªºÄÝ©Ê¡A¤]¬O¤@ª«¥ó

§ó©ú½Tªº»¡´N¬OWorksheetª«¥óÃþ§O¤¤¦³¹³¤U­±³o¼Ëªº©w¸q¡A¦^¶ÇRangeª«¥ó
Public Property Get UsedRange() as Range
    Set UsedRange = XXXX
End Property

¦P²zRows¤§©óRangeªºÃö«Y¤]¬O³o¼Ë
ªí¹F¤£²M¡BÃD·N¤£©ú½T¡B¨SªþÀɮ׮榡¡B¨S¦³°Q½×°ÝÃDªººA«×~~~~~~¥H¤W·R²ö¯à§U¡C

TOP

Microsoft ªº»¡©ú
UsedRange ÄÝ©Ê - ¶Ç¦^¤@­Ó Range ª«¥ó¡A¦¹ª«¥ó¥Nªí«ü©w¤u§@ªí¤¤ªº¤w¥Î½d³ò¡C°ßŪ¡C

¥¦¬OÄÝ©Ê, ¦ý·|¦^¶Ç¤@­Ó Range ª«¥ó, ©Ò¥H´N½Ð·í¦¨¤@­Ó Range ª«¥ó¨Ó¨Ï¥Î

TOP

¥»©«³Ì«á¥Ñ bobomi ©ó 2015-3-25 14:07 ½s¿è

Sheet1.UsedRange
   ª«¥ó.ÄÝ©Ê

UsedRange.Rows
          ª«¥ó.ÄÝ©Ê

Rows.Count
  ª«¥ó.ÄÝ©Ê

¦³¨S¦³¬Ý¨ì UsedRange ¬J¬OÄݩʤ]¬Oª«¥ó

¨º UsedRange "¯u¥¿¦Û§Ú" ªºªí²{§Î¦¡¬O¤°»ò? ¬Oª«¥ó
¦]¬°¥¦«á­±¥i¥H¥[  .  ªí¥Ü¥L¬O¦U¶°¦XÅé ( °£«D¸Ì­±¨S©ñ¤½¶}ªºÄÝ©Ê, ¤£µM¤@¨Ã¥i¥H¥[ . )

Msgbox isObject(UsedRange)
Msgbox isObject(UsedRange.Rows.Count)

TOP

¥»©«³Ì«á¥Ñ pigexcel2992 ©ó 2015-3-25 19:20 ½s¿è

¬Ý¤j®aµ¹ªºµª®×¡A®ø¤Æ¤@¤U¡A²z¸Ñ¦p¤U

Aª«¥ó.BÄÝ©Ê

ª«¥ó©I¥sÄݩʨӥΡA¦ý¬OÄÝ©Ê·|¦^¶Ç¤@­Óª«¥ó

¦]¬°BÄݩʦ³¦^¶Çªºª«¥ó¡A©Ò¥H¥i¥H§Q¥Î¦¹ª«¥ó¨Ó©I¸û¦¹ª«¥óªºÄݩʨӥÎ


¦pªG«á­±¤S³o¼Ë¥H¦¹Ãþ±À¤U¥h
Aª«¥ó.BÄÝ©Ê.C.D.E
«á­±ªº C D ³£¬O¦]¬°¦³¦^¶Çªºª«¥ó¡A©Ò¥H¤~¥i¥H©I¥sÄÝ©Ê¥X¨Ó¥Î¡AµM«á¤@­È±µ¤U¥h

³o¼Ë·QÀ³¸Ó¨S¿ù§a ?

TOP

¦^´_ 5# pigexcel2992
  1. Option Explicit
  2. Sub Ex()
  3.     With ActiveSheet.[F5:H15]
  4.         MsgBox .Columns.Count
  5.         With .Columns(4)
  6.             MsgBox .Address & " - ¦@¦³" & .Cells.Count & "­Ó Cells"
  7.             With .Range("B" & .Cells.Count)
  8.                 MsgBox .Address
  9.             End With
  10.         End With
  11.     End With
  12. End Sub
½Æ»s¥N½X
·P®¦ªº¤ß......(¦b³Â»¶®a±Ú°Q½×°Ï.¥Î¤ß¾Ç²ß·|¦³¶i¨Bªº)
¦ý¸ê·½µL­­,«á´©¦³­­,  ¤@¤Ñ1¤¸ªºÃÙ§U,¤H¤H¦³¯à¤O.

TOP

        ÀR«ä¦Û¦b : ·R¤£¬O­n¨D¹ï¤è¡A¦Ó¬O­n¥Ñ¦Û¨­ªº¥I¥X¡C
ªð¦^¦Cªí ¤W¤@¥DÃD