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

½Ð°Ý¦U¦ì¦Ñ®v¡A­n¦p¦ó¹ïÀ³¥H¤Uªº¼Æ¶q

½Ð°Ý¦U¦ì¦Ñ®v¡A­n¦p¦ó¹ïÀ³¥H¤Uªº¼Æ¶q

BÄæ¦ì¹ïÀ³AÄæ¦ì¼Æ¶q¥H270¬°³æ¦ì
½Ð°Ý­n¦p¦ó­×§ï¡A¤@­ÈµLªkºâ±oBÄæ¼Æ¶q
  1. Sub to2test()

  2. Dim e&, st$, sb$
  3. st = Cells(1, 4)
  4. sb = Cells(1, 5)
  5. e = [a65536].End(3).Row - 1: If e < 1 Then Exit Sub
  6. For i = 3 To e
  7.    If Cells(i, 1) = "" Then
  8.       Cells(i, 2) = ""
  9.    
  10.     On Error Resume Next
  11.    
  12.     ElseIf Cells(i, 1) < st Then
  13.     Cells(i, 2) = -Int(-Cells(i, 1) / st)
  14.     ElseIf Cells(i, 1) + Cells(i - 2, 1) + Cells(i - 1, 1) > sb Then
  15.     Cells(i, 2) = -Int(-Cells(i, 1) / st) - 1
  16.     ElseIf Cells(i, 1) + Cells(i - 2, 1) + Cells(i - 1, 1) = sb Then
  17.     Cells(i, 2) = -Int(-Cells(i, 1) / st) - 1
  18.     ElseIf Cells(i, 1) + Cells(i - 2, 1) = sb Then
  19.     Cells(i, 2) = -Int(-Cells(i, 1) / st) - 1
  20.     Else
  21.    
  22.    
  23.     End If
  24. Next

  25. Cells(4, 5) = -Int(-Cells(4, 4) / st)


  26. End Sub
½Æ»s¥N½X

¬¡­¶Ã¯test.rar (11.51 KB)

¦^´_ 2# samwang

¬¡­¶Ã¯test.rar (13.21 KB)

Sam¡A©êºp¶Ç¿ùÀɮסAÀ³¸Ó¬°ªþ¥ó¡A³W«h¤´¬°1080

TOP

        ÀR«ä¦Û¦b : ¨C¤ÑµL©Ò¨Æ¨Æ¡A¬O¤H¥Íªº®ø¶OªÌ¡A¿n·¥¡B¦³¥Î¤~¬O¤H¥Íªº³Ð³yªÌ¡C
ªð¦^¦Cªí ¤W¤@¥DÃD