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

[µo°Ý] ½Ð°Ý¦³msgbox¥Î"ª«¥ó¬d¸ß"¥¨¶°¯àÀ°¤p§Ì¸Ñ¨M°ÝÃD¶Ü?

¦^´_ 2# Hsieh
­è­è§Ñ¤F¥Î¦^´_¥\¯à

´£¨Ñªº½d¨Ò°ÝÃD»PExcel«Ü¦n¬Ý¥Xµª®×¡A¦]¬°¯u¹ê¼Æ¾Ú¤W¦Êµ§Ãö«Y¨ì®×¨Ò¤½¥q¾÷±K
©Ò¥H¥u¯à¥Î³¡¤À¼Æ¾Ú¦b¦¹¸ß°Ý·PÁ¯ണ¨Ñ«ü¥OÅý¤p§Ì¯à¶¶§Q°õ¦æ¡C

TOP

­º¥ý¡A·PÁÂHsieh¬°¤p§Ì©âªÅ¬Û§U¡A©êºpªí¹F±o¤£°÷¸Ô²Ó¡A¦b¤U­±¸É¥R»¡©ú¡I

²Ä¤@ÃDªº³¡¤À¦]¬°excelµy°µ­×¥¿¡AwordÀɧѰO§óÅܵª®×¡A©êºp¡C

²Ä¤GÃDªº³¡¤À»¡©úA¦ÜH¤¸¥ó¦b¦U¦¾¬VÀô¹Òªº¼vÅT%¼Æ¡AÃD¥Ø¤¤©Ò­z¤§¸ß°Ý
­Y¨Ï¥ÎªÌ·Q§ä¤¸¥óA¦ÜH"·Å«Ç®ÄÀ³"¼vÅT³ÌÄY­«ªº¤¸¥ó¡A«hVBAµ¹¥Xªºµª®×¬°"C¤¸¥ó"
­Y¨Ï¥ÎªÌ·Q§ä¤¸¥óA¦ÜH"­«ª÷ÄÝ"¼vÅT³ÌÄY­«ªº¤¸¥ó¡A«hVBAµ¹¥Xªºµª®×¬°"E¤¸¥ó"

²Ä¤TÃD©Ó±µ²Ä¤GÃD¡A°²¦p¨Ï¥ÎªÌ¦b²Ä¤GÃD¸ß°Ý"·Å«Ç®ÄÀ³"¼vÅT³ÌÄY­«ªº¤¸¥ó
µª®×µ¹¥X"C¤¸¥ó"
±q²Ä¤GÃD¥i¥Hª¾¹DC¤¸¥ó¬O¸Ó²£«~¤¸¥ó¤¤¹ï"·Å«Ç®ÄÀ³"±a¨Óªº¼vÅT³Ì¤j
©Ò¥H¨Ï¥ÎªÌ·|¥h´M§ä¥i¥H´À¥N"C¤¸¥ó"ªº¤¸¥ó¡A³o¤]¬O²Ä¤TÃDªº½×­z
¨Ï¥ÎªÌ±q­ì¥ý"C¤¸¥ó"»P¥i¥H¥Î¨Ó´À¥NC¤¸¥óªº"¤¸¥óC-1"¡B"¤¸¥óC-2"
¦]¬°³o¨Ç´À¥N¤¸¥ó¦b"·Å«Ç®ÄÀ³"³£¤ñ­ì¥ýªº§C¡A©Ò¥H¨Ï¥ÎªÌ¦b²Ä¤TÃD·|¤ñ¸û³o¤T­Ó¤¸¥ó
¹ï"¾ã­ÓÀô¹Ò¦¾¬VÁ`Åv­«­È(¤]´N¬OZÄæ¦ìªº­È)"¡A´M§ä¨®ZÄæ¦ì­È³Ì§Cªº¤¸¥ó¬°C-2
¥Nªí¤¸¥óC-2¬O¥i¥H¥Î¨Ó´À¥N­ì¥ýC¤¸¥óªº´À¥N©Ê¤¸¥ó¡C

¤£ª¾¹D³o¼Ë±Ô­z¦³¨S¦³¤ñ¸û²M·¡¡A·PÁªá¶O®É¶¡À°¦£¡C

TOP

¦^´_ 1# joey77373
§AÁ|¨Òªºµª®×¦ü¥G»PÀɮפº®e¤£²Å
²Ä¤@ÃD­Y¬O¥H20%¬°°ò·ÇÀ³¸Ó¥u¦³C¡BE

²Ä¤GÃD¬O­n§ä¥XL:Qªº³Ì¤j­È¶Ü?¨ºÀ³¸Ó¬OC¤¸¥óªº­PÀù©Ê%¼Æ
  1. Public Rng As Range
  2. Sub ²Ä¤@ÃD()
  3.     Dim myInput, i As Integer, Ar As Variant, MyMax#, MyStr
  4.     Dim Str As String, Dic As Object
  5.     myInput = InputBox("½Ð¿é¤JÁ`¦¾¬VªùÂe­È(%):")
  6.     Set Dic = CreateObject("Scripting.Dictionary")
  7.     For i = 2 To 9
  8.     If Not IsNumeric(Cells(i, 9)) Then MsgBox "I" & i & "½Ð¿é¤J¼Æ¦r": Exit Sub
  9.       If Cells(i, 9) >= (myInput / 1) Then
  10.          Dic(Cells(i, 1).Value) = Array(Cells(i, 9), Cells(i, 1))
  11.          If Rng Is Nothing Then Set Rng = Cells(i, "L").Resize(, 6) Else Set Rng = Union(Rng, Cells(i, "L").Resize(, 6))
  12.       End If
  13.     Next i
  14.     If Dic.Count = 0 Then MsgBox "¨S¦³²Å¦X±ø¥óªº¤¸¥ó": Set Rng = Nothing: Exit Sub
  15.     TestStr = Join(Dic.keys, ",")
  16.     Do Until Dic.Count = 0
  17.      Ar = Application.Transpose(Application.Transpose(Dic.items))
  18.      MyMax = Application.Max(Application.Index(Ar, , 1))
  19.      MyStr = Application.VLookup(MyMax, Ar, 2, 0)
  20.      MsgBox "¤¸¥ó  " & MyStr & "  " & MyMax
  21.      Dic.Remove MyStr
  22.     Loop
  23. End Sub
½Æ»s¥N½X
  1. Sub ²Ä¤GÃD()
  2. Dim MyMax#, MyStr$, MyTital$
  3. If Rng Is Nothing Then MsgBox "¥¼¦³²Å¦X¤§¤¸¥ó¡A½Ð¥ý°õ¦æ²Ä¤@ÃD": Exit Sub
  4. If Application.Count(Rng) <> Rng.Count Then MsgBox Rng.SpecialCells(xlCellTypeConstants, 2).Address & "¬°«D¼Æ­È¸ê®Æ": Exit Sub
  5. MyMax = Application.Max(Rng)
  6. MyStr = Cells(Rng.Find(MyMax, lookat:=xlWhole).Row, "A")
  7. MyTital = Cells(1, Rng.Find(MyMax, lookat:=xlWhole).Column)
  8. MsgBox "¤¸¥ó  " & MyStr & MyTital & "  " & Format(MyMax, "0.00%")
  9. End Sub
½Æ»s¥N½X
²Ä¤TÃD´N¬Ý¤£¥X»P²Ä¤@¡B¤GÃD¦³¦óÃöÁp©Ê¡A½Ð¸Ô²Ó»¡©ú¤§
¾Ç®üµL²P_¤£®¢¤U°Ý

TOP

        ÀR«ä¦Û¦b : °µ¦n¨Æ¤£¯à¤Ö§Ú¤@¤H¡A°µÃa¨Æ¤£¯à¦h§Ú¤@¤H¡C
ªð¦^¦Cªí ¤W¤@¥DÃD