返回列表 上一主題 發帖

[發問] 想在不同的檔案中,捉取不同sheet中相同位置的資料,有機會實現嗎?

回復 1# chres
  1. Sub ex()
  2. Dim Ay(), Sh As Worksheet
  3. ar = Array("B", "C", "D", "P", "Z", "AJ", "AT", "BL", "BM", "BP", "BQ", "BR", "CM", "CW", "DG", "EB", "EC")
  4. Set Sh = Sheets.Add(after:=Sheets(Sheets.Count))
  5. For i = 5 To 6
  6. With Sheets(i)
  7.   For j = 0 To UBound(ar)
  8.     ReDim Preserve Ay(s)
  9.     Ay(s) = Application.Transpose(.Range(ar(j) & 13 & ":" & ar(j) & 268))
  10.     s = s + 1
  11.   Next
  12.   Sh.Cells(Rows.Count, 1).End(xlUp).Offset(1).Resize(256, UBound(ar) + 1) = Application.Transpose(Ay)
  13.   s = 0
  14.   Erase Ay
  15. End With
  16. Next
  17. Sh.Range("A:A").SpecialCells(xlCellTypeBlanks).EntireRow.Delete
  18. Set Sh = Nothing
  19. End Sub
複製代碼
學海無涯_不恥下問

TOP

        靜思自在 : 生氣,就是拿別人的過錯來懲罰自己。
返回列表 上一主題