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

[µo°Ý] ·j´M²Å¦X±ø¥óªº³Ì¤p­È¤Î³Ì¤j­È

[µo°Ý] ·j´M²Å¦X±ø¥óªº³Ì¤p­È¤Î³Ì¤j­È

½Ð±Ð¦U¦ì¤j¤j,
¥H¤U¸ê®Æ¬°sheet 1,­Y§Ú¦bsheet 2¥HINV¬°¥D§@·j´M¹ï·Ó,¦p¦ó§ì¨úBCMªº³Ì¤p­È?(¥¦¦³¼Æ¦r¤Î¤å¦r)
¨Ò¦p:sheet 2ªºAÄæ¦ì¬OINV,BÄæ¦ì¬OBCM³Ì¤p­È,CÄæ¦ì¬OBCM³Ì¤j­È
CI12-002  ³Ì¤p­È§Ú§Æ±æ§ä¨ìªº¬OB2= 120001,³Ì¤j­È¬OC2=120362-2

INV                         BCM
CI12-002        120351
CI12-008        120352
CI12-003        120353
CI12-004        120354
CI12-005        120355
CI12-002        120358-3
CI12-001        120362-1
CI12-002        120362-2
CI12-002        120001
CI12-002        120014-1A

¦^´_ 1# PJChen

¤å¦r»P¼Æ¦r¤ñ¸û¤j¤p¡A¤º«Ø¨ç¼ÆµLªk¹F¦¨
³Ì¤j³Ì¤p.rar (8.47 KB)
¾Ç®üµL²P_¤£®¢¤U°Ý

TOP

¦^´_ 2# Hsieh
¦^´_ 1# PJChen
¤£¦n·N«ä¡A­É¥Î Hsieh ª©¤jªº»yªkµy¥[­×¹¢¡G
  1. Sub Test()
  2.     Dim ans As Variant
  3.    
  4.     ans = RankData(Range("B2:B11"), True)
  5.     MsgBox "³Ì¤j­È¬° " & ans
  6.     ans = RankData(Range("B2:B11"), False)
  7.     MsgBox "³Ì¤p­È¬° " & ans
  8. End Sub

  9. Function RankData(Rng As Range, asc As Boolean) As Variant
  10.     Dim rn As Variant
  11.    
  12.     For Each rn In Rng
  13.         If asc = True Then
  14.             RankData = IIf(RankData = "", rn, IIf(rn > RankData, rn, RankData))
  15.         Else
  16.             RankData = IIf(RankData = "", rn, IIf(rn < RankData, rn, RankData))
  17.         End If
  18.     Next
  19. End Function
½Æ»s¥N½X

TOP

        ÀR«ä¦Û¦b : «Ý¤H°h¤@¨B¡A·R¤H¼e¤@¤o¡A´N·|¬¡±o«Ü§Ö¼Ö¡C
ªð¦^¦Cªí ¤W¤@¥DÃD