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

[µo°Ý] ·j´M+Âà¸m¶K¤Wªº¨ç¼Æ¤½¦¡

¥»©«³Ì«á¥Ñ luhpro ©ó 2021-1-6 23:09 ½s¿è
´ú¸ÕÀÉ¡J
»Ý¨Da¡J
·í¤u§@ªíAªºB2¡JB51=ªÅ¥Õ®É¡A«h±N¨ä¦P¦CAÄ檺­È¡AÂà¸m¶K¤W¤u§@ªíBªºB104¡JAX104
·í¤u ...
ziv976688 µoªí©ó 2021-1-5 18:22

Àx¦s®æ¤½¦¡§Ú©l²×¤£¬O¬Ý±o«ÜÀ´,
¨Ì¾Ú§Aµu®ø®§©Ò»¡§Ú³o¸Ì´£¨ÑVBAµ{¦¡ªº¸Ñ¨M¤è¦¡,
¸Õ¸Õ¬Ý.
  1. Sub Tran()
  2.   Dim iI1%, iI2%
  3.   Dim lSum&, lRow%
  4.   Dim shSou As Worksheet, shTar As Worksheet
  5.   
  6.   Set shSou = Worksheets("A")
  7.   Set shTar = Worksheets("B")
  8.   With shTar
  9.     .Range(.[B104], .[AX268]).ClearContents
  10.   End With
  11.   With shSou
  12.     For iI2 = 0 To 1
  13.       For lRow = 2 To 18
  14.         lSum = 0
  15.         For iI1 = 2 To 51
  16.           lSum = lSum + Cells(lRow, iI1)
  17.         Next
  18.         If lSum = 0 Then
  19.           Debug.Print iI2 * 39 + lRow & " , " & 102 + iI2 * 98 + lRow
  20.           .Cells(iI2 * 39 + lRow, 1).Resize(50).Copy
  21.           shTar.Cells(102 + iI2 * 98 + lRow, 2).PasteSpecial Paste:=xlPasteAll, Transpose:=True
  22.         End If
  23.       Next
  24.    
  25.       For lRow = 2 To 19
  26.         lSum = 0
  27.         For iI1 = 2 To 51
  28.           lSum = lSum + Cells(lRow, iI1)
  29.         Next
  30.         If lSum = 0 Then
  31.           Debug.Print iI2 * 39 + 19 + lRow & " , " & 151 + iI2 * 98 + lRow
  32.           .Cells(iI2 * 39 + 19 + lRow, 1).Resize(50).Copy
  33.           shTar.Cells(151 + iI2 * 98 + lRow, 2).PasteSpecial Paste:=xlPasteAll, Operation:=xlNone, _
  34.                   SkipBlanks:=False, Transpose:=True
  35.         End If
  36.       Next
  37.     Next
  38.   End With
  39. End Sub
½Æ»s¥N½X

TOP

        ÀR«ä¦Û¦b : ¨Ã«D¦³¿ú¾{¬O§Ö¼Ö¡A°Ý¤ßµL·\¤ß³Ì¦w¡C
ªð¦^¦Cªí ¤W¤@¥DÃD