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

[µo°Ý] ²¤Æµ{¦¡

[µo°Ý] ²¤Æµ{¦¡

­è­è¶}©l¾Ç²ßVBAµ{¦¡·Q½Ð°Ý¦U¦ì±M®a¥i¥H²¤Æªº¤èªk
°²³]§Úªº¸ê®Æ¦³(C2:C500)

Sub abc()

'§PÂ_¾ú¥v³Ì¤j­È¬O§_¤j©ó¥Ø«e­È¡A¨Ã¥H³Ì¤j­È§ó·s¾ú¥v³Ì¤j­È
If Worksheets("Sheet1").Range("C2") < Worksheets("Sheet1").Range("B2").Value Then
    Worksheets("Sheet1").Range("C2").Value = Worksheets("Sheet1").Range("B2").Value

End If

If Worksheets("Sheet1").Range("C3") < Worksheets("Sheet1").Range("B3").Value Then
    Worksheets("Sheet1").Range("C3").Value = Worksheets("Sheet1").Range("B3").Value

End If

If Worksheets("Sheet1").Range("C4") < Worksheets("Sheet1").Range("B4").Value Then
    Worksheets("Sheet1").Range("C4").Value = Worksheets("Sheet1").Range("B4").Value

End If

End Sub
·PÁ±оÉ

¦^´_ 1# gelai01000001

³o¼ËÀ³¸Ó¦³²Å¦X§Aªº»Ý¨D§a

Sub abc()
For i = 2 To 4
'§PÂ_¾ú¥v³Ì¤j­È¬O§_¤j©ó¥Ø«e­È¡A¨Ã¥H³Ì¤j­È§ó·s¾ú¥v³Ì¤j­È
If Sheet1.Cells(i, 3) < Sheet1.Cells(i, 2).Value Then
     Sheet1.Cells(i, 3) = Sheet1.Cells(i, 2).Value
End If
Next
End Sub

TOP

·PÁÂOwen06«e½ú±M®aªº«ü¾É
²¤Æ¹L«áªº»yªk½T¹ê§Ú·Q­n±o
For i = 2 To 4
­×§ï
For i = 2 to 500§Y¥i¹B¦æ¤S¦h¤F¸ÑCells»yªkªºÀ³¥Î

TOP

Owen06«e½ú¤£¦n·N«ä!°õ¦æµ{¦¡¹Lµ{¤S¥X²{¤@¨Ç°ÝÃD·Q¦A½Ð±Ð¤@¤U

¦pªG"BÄæ¦ì"·í¤¤¥ô¦ó1¦C¥X²{(#N/A¡B--¡B©Î«D¼Æ­È)ªº­È¡A«h·|°±¤î¹Bºâ¸Ó¦p¦ó³B²z

BÄæ           CÄæ
¼Æ­È        ³Ì¤j­È
38.95        38.95
37.95        37.95
13.85        13.85
19.6        19.6
10.45        10.45
14.95        14.95
55.8        55.8
23.6        23.6
#N/A        (¸õ¥X"«¬ºA¤£²Å¦X"ªºÄµ§i¤å¦rµøµ¡)
21.5       
14.8

TOP

¦^´_ 4# gelai01000001
  1. Sub test()
  2.     For i = 1 To 5           
  3.         '  §PÂ_¾ú¥v³Ì¤j­È¬O§_¤j©ó¥Ø«e­È¡A¨Ã¥H³Ì¤j­È§ó·s¾ú¥v³Ì¤j­È
  4.         If Not IsError(Sheet1.Cells(i, 2)) Then
  5.              If Sheet1.Cells(i, 3) < Sheet1.Cells(i, 2).Value Then _
  6.                  Sheet1.Cells(i, 3) = Sheet1.Cells(i, 2).Value
  7.         End If
  8.     Next
  9. End Sub
½Æ»s¥N½X

TOP

¦^´_ 4# gelai01000001



Sub try2()
For Each mr In Range([b2], [b65536].End(xlUp))
If Not IsError(mr) Then
   If mr.Value > mr.Offset(0, 1).Value Then _
      mr.Offset(0, 1).Value = mr.Value
End If
Next
End Sub

TOP

¦^´_ 4# gelai01000001

¤µ¤Ñ¨t²Î©Ç©Çªº¡A©Ò¥H¨S¿ìªk¦b¦P¤@½g¦^ÂСK
¦pªG§Aªº¸ê®Æ·|¤@ª½·s¼W¤U¥hªº¸Ü¡A§ï¦¨¤W­±ªº¤èªk·|¤ñ¸û¾A·í¡A
¤~¤£¥Î±`±`¦b¨ºÃä§ïi=2 to x¡A¤]¤£¥Î¹w³]¤Ó¦h¡AÅýµ{¦¡¦h¶]¨º¨ÇªÅ¸ê®Æ®æ¡A
³o¨Ç¤]³£¬O§Ú­è±qª©¤Wªº«e½ú­Ì¨º¾Ç¨Óªº¡A¤@°_¥[ªo§a~

TOP

·PÁÂOwen06¡Bc_c_lai«e½ú±M®a¼ö¤ßªº«ü¾É¸Ñ´b

¨âºØµ{¦¡³£´ú¸Õ¹L¤F¥i¹BºâµL»~©O!
¥i¬O°õ¦æµ{¦¡®Éµo²{¡qtry2()ªº¹Bºâ®É¶¡·|¤Ö©ótest()¡r¡C

ÁÂÁ°Õ!

TOP

        ÀR«ä¦Û¦b : µÊ®ð¼L¤Ú¤£¦n¡A¤ß¦a¦A¦n¤]¤£¯àºâ¬O¦n¤H¡C
ªð¦^¦Cªí ¤W¤@¥DÃD