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

[µo°Ý] §Ö³t§ä¥X½d³ò¤º³Ì¤j¦C¼Æ

[µo°Ý] §Ö³t§ä¥X½d³ò¤º³Ì¤j¦C¼Æ

¦U¦ì¦n
§Ú§Q¥Î¤U¦Cªº¥N½X
  1. Dim N11, N2, N3, N4, N5, MaxRow As Integer
  2.             N11 = Cells(Rows.Count, 2).End(xlUp).Row 'BÄ檺³Ì«á¤@¸ê®Æ®æªº¦C¼Æ
  3.             N2 = Cells(Rows.Count, 3).End(xlUp).Row 'CÄ檺³Ì«á¤@¸ê®Æ®æªº¦C¼Æ
  4.             N3 = Cells(Rows.Count, 4).End(xlUp).Row
  5.             N4 =Cells(Rows.Count, 5).End(xlUp).Row
  6.             N5 = Cells(Rows.Count, 6).End(xlUp).Row
  7.             
  8.             MaxRow1 = Application.WorksheetFunction.Max(N1, N2, N3, N4, N5) '¨D¥X³Ì¤W­z½d³ò¤¤³Ì¤j¼Æ
½Æ»s¥N½X
§ä¥XB¦ÜFÄ檺½d³ò¤¤ªº³Ì¤j¦C¼Æ
·Q½Ð°Ý¦U¦ì¦³¨S¦³¨ä¥L§ó§Öªº¤è¦¡,©Î¬O§ó¦nªº¤è¦¡,¥i¥H¹F¨ì©ó¯S©w½d³ò¤º§ä¥X³Ì¤j¦C¼Æ
ÁÂÁÂ

¦^´_ 1# ciboybj

°²³]©Ò¦³¸ê®Æ³£¬O»PBÄ椤¦³¸ê®Æªº³Ì«á¤@¦C¬Û³s¦b¤@°_ªº:

MaxRow1 = Cells(Cells(Rows.Count, 2).End(xlUp).Row, 2).CurrentRegion.Rows.Count

TOP

¦pªG¬O¾ã­¶,§Ú²ßºD¥Î Usedrange
MaxRow1 = ActiveSheet.UsedRange.SpecialCells(11).Row
À´±oµo°Ý,µª®×´N·|¦b¨ä¤¤

¤µ¤éの¤@¬íは  ©ú¤éにない
http://kimbalko-chi.blogspot.com
http://kimbalko.blogspot.com

TOP

¦^´_ 1# ciboybj
  1. Function GetLastRow(rng As Range) As Long
  2.   Dim rngFind As Range
  3.   
  4.   Set rngFind = rng.Find(what:="*", Searchorder:=xlByRows, SearchDirection:=xlPrevious)
  5.   If Not rngFind Is Nothing Then
  6.     GetLastRow = rngFind.Row
  7.   Else
  8.     Err.Raise vbObjectError + 1025, "GetLastRow()", "½d³ò¤º§ä¤£¨ì¥ô¦ó¸ê®Æ"
  9.   End If
  10. End Function
½Æ»s¥N½X
  1. Sub Test()
  2.   MsgBox GetLastRow(ActiveSheet.[B:G])
  3. End Sub
½Æ»s¥N½X

TOP

¦^´_ 1# ciboybj
¥Î·j´M§Ö¤@¨Ç
  1. Option Explicit
  2. Sub Ex()
  3.     Dim Rng As Range
  4.     With Range("B2:E15")
  5.         Set Rng = .Find(What:="*", After:=.Cells(1), SearchDirection:=xlPrevious)
  6.         'SearchDirection:=xlPrevious ·j´M¤è¦V:©¹«á
  7.     End With
  8.     If Not Rng Is Nothing Then MsgBox Rng.Row
  9. End Sub
½Æ»s¥N½X
·P®¦ªº¤ß......(¦b³Â»¶®a±Ú°Q½×°Ï.¥Î¤ß¾Ç²ß·|¦³¶i¨Bªº)
¦ý¸ê·½µL­­,«á´©¦³­­,  ¤@¤Ñ1¤¸ªºÃÙ§U,¤H¤H¦³¯à¤O.

TOP

ÁÂÁ¦U¦ìªº¤À¨É!!

TOP

        ÀR«ä¦Û¦b : ¡i°µ¤Hªº¶}©l¡j¨C¤@¤Ñ³£¬O¬G¤Hªº¶}©l¡A¨C¤@­Ó®É¨è³£¬O¦Û¤vªºÄµ±§¡C
ªð¦^¦Cªí ¤W¤@¥DÃD