我目前正在Excel Workbook中使用36个包含相似数据的选项卡。 幸运的是,大多数数据都放在每个选项卡上的相同单元格编号中。 我已经使用VBA从每个标签中提取数据并填充了最后一个名为“输出”的标签
Public Sub test()
Dim currentWorkbook As Workbook
Dim currentSheet As Worksheet
Dim otherSheet As Worksheet
Dim i As Integer
Dim j As Integer
Set currentWorkbook = ActiveWorkbook
Set otherSheet = currentWorkbook.Worksheets("Output")
i = 1
For Each currentSheet In currentWorkbook.Worksheets
otherSheet.Range("A" & i).Value = currentSheet.Range("A2").Value
otherSheet.Range("B" & i).Value = currentSheet.Range("D20").Value
otherSheet.Range("AG" & i).Value = currentSheet.Range("E20").Value
otherSheet.Range("BI" & i).Value = currentSheet.Range("F20").Value
otherSheet.Range("CN" & i).Value = currentSheet.Range("G20").Value
otherSheet.Range("DR" & i).Value = currentSheet.Range("H20").Value
i = i + 1
Next currentSheet
Set currentSheet = Nothing
Set currentWorkbook = Nothing
数据看起来像这样
我正在尝试填充剩余的日期,例如将B2:AF2范围内的数据填充到B2中。
有人可以建议我该怎么做吗?