我想剪切并粘贴一定范围的单元格(例如A2:D2到B1:E1),然后对692行重复此过程。
我一直试图在宏中执行此操作,但未成功。
Sub cut_paste()
Dim nr As Integer
For nr = 1 To 692
Range("A" & nr).Select
Selection.Cut
Range("B" & nr).Select
ActiveSheet.Paste
Range("B" & nr).Select
Selection.Cut
Range("C" & nr).Select
ActiveSheet.Paste
Range("C" & nr).Select
Selection.Cut
Range("D" & nr).Select
ActiveSheet.Paste
Range("D" & nr).Select
Selection.Cut
Range("E" & nr).Select
ActiveSheet.Paste
Next nr
End Sub
错误4001
答案 0 :(得分:2)
尝试:
Map<Sale, Integer> map = list.stream()
.collect(Collectors.groupingBy(o -> o, Collectors.summingInt(Sale::getField4)));
答案 1 :(得分:1)
首先,您为第2到692行创建一个循环:
For i = 2 to 692
'code to execute in the loop goes here
Next i
然后在该循环中复制/粘贴
For i = 2 to 692
Sheet1.Range("A" & i & ":D" & i).Copy Destination:=Sheet1.Range("B" & i - 1 & ":E" & i - 1)
Next i