我正在尝试将两个工作簿的两行中的一组单元格分配给两个范围。此信息用于执行comparison of the contents of both workbooks rows by ID。
我尝试使用“ with”语句。
Dim aWorkbookBInfo() As Variant, aWorkbookAInfo() As Variant, rngWorkbookBToCompare As Range, rngWorkbookAToCompare As Range
Dim SumToCheck As Integer, FoundCell As Range, aCellValues() As Integer
ReDim aCellValues(LastSheetColumn - 1)
ReDim aWorkbookBInfo(LastSheetColumn - 1)
ReDim aWorkbookAInfo(LastSheetColumn - 1)
For i = 2 To LastSheetRow
Set FoundCell = Workbooks(WorkbookA).Sheets(SheetNameFromArray).Range("A:A").Find(What:=Workbooks(WorkbookB).Sheets(SheetNameFromArray).Cells(i, 1).Value)
If Not FoundCell Is Nothing Then
aCellValues(0) = 1
Workbooks(WorkbookB).Sheets(SheetNameFromArray).Cells(i, LastSheetColumn + 1).Value = FoundCell.Row
With Workbooks(WorkbookB).Sheets(SheetNameFromArray)
Set rngWorkbookBToCompare = Range(Cells(i, 2), Cells(i, LastSheetColumn))
End With
With Workbooks(WorkbookA).Sheets(SheetNameFromArray)
Set rngWorkbookAToCompare = Range(Cells(FoundCell.Row, 2), Cells(FoundCell.Row, LastSheetColumn))
End With
aWorkbookBInfo = rngWorkbookBToCompare
aWorkbookAInfo = rngWorkbookAToCompare
For j = 1 To LastSheetColumn - 1
If aWorkbookBInfo(1, j) = aWorkbookAInfo(1, j) Then
aCellValues(j) = 1
Else
aCellValues(j) = 0
End If
Next j
Else
End If
Next i
我想存储两个工作簿中单元格组的内容而不激活它们,因为我认为此过程会更快。
我尝试的操作仅获取活动工作簿的信息,而不是两个工作簿。
答案 0 :(得分:2)
在var subscribeController: SubscribeController = new SubscribeController()
var routeAction = subscribeController.unsubscribe
subscribeController.unsubscribe() // SubscribeController {persister: Persister}
routeAction() // undefined
或.
引用之前使用句点Range
,以完全限定Cells
块内的Worksheet
。
With...End With
再次:
With Workbooks(WorkbookB).Sheets(SheetNameFromArray)
Set rngWorkbookBToCompare = .Range(.Cells(i, 2), .Cells(i, LastSheetColumn))
End With
在这段时间内,With Workbooks(WorkbookA).Sheets(SheetNameFromArray)
Set rngWorkbookAToCompare = .Range(.Cells(FoundCell.Row, 2), .Cells(FoundCell.Row, LastSheetColumn))
End With
无效。由于With...End With
和ActiveSheet
调用不完全合格,因此暗示了ActiveWorkbook
和Range
。