这里的第一次海报。
我有一个文件列表(file1
,file2
,file3
),我想将这些文件中的范围复制到主文件中。主文件包含一个包含此数据file1
,file2
,file3
的列。如何遍历该列并将每个文件的范围复制并粘贴到主文件中的相应行?我需要file1
中的数据进入与file1
相同的行中的范围。
这是我到目前为止所做的:
Dim col As Range
Dim cell As Range
Dim currentRow As Long
Dim varCellValue As String
Dim pasteRangeC As String
Dim pasteRangeE As String
Set col = Range("B3:B5")
currentRow = 3
For Each cell In col
varCellValue = cell.Value
currentRow = 3
pasteRangeC = "C" & currentRow
pasteRangeE = "E" & currentRow
'## Open workbooks:
Set x = Workbooks.Open("C:\Folder\" & varCellValue &_ ".xlsx")
Set y = ThisWorkbook
'Copy from x:
x.Sheets("Summary").Range("D13:F13").Copy
'Paste to y worksheet:
y.Sheets("Sheet1").Range(pasteRangeC & ":" & pasteRangeE).PasteSpecial xlPasteValues
'Close x:
x.Close
currentRow = currentRow + 1
Next
End Sub
代码适用于第一个循环,然后我得到运行时错误1004,找不到该文件。所以我认为varCellValue
没有获得下一个单元格的值。
有人能指出我正确的方向吗?
答案 0 :(得分:0)
根据我阅读的内容,尝试以下
CoordinatorLayout.Behavior behavior = (CoordinatorLayout.Behavior)fab.getLayoutParams();
int boundary = fab.getTop() + (fab.getHeight() * 0.5);
//inside `BottomSheet` callback methods
if(sheetView.getTop() >= boundary){
//sheet is expanding or its peeking height was changed
behavior.setAnchorId(sheetView.getId());
} else if (sheetView.getTop() <= boundary){
//sheet is animating to collapse, being collapsed
behavior.setAnchorId(mapView.getId());
}