下标超出范围打印单元格

我的问题是细胞开始累积在下面一行的部分

currentsheet.Cells(b, a) = currentsheet.Cells(b, a) + Workbooks(d).Sheets(c).Cells(b, a)

它抛出我

下标超出范围

我的代码应该是从三个不同的工作簿的多个图表中获取数字,并将其放入另一个工作簿的一个主工作表中,同时添加每个图表中的所有数字。 所有的工作表都被命名和格式化。

 Sub bringbookstogether() Dim currentsheet As Worksheet Set currentsheet = Application.ActiveSheet 'assigns the number to start with Dim a, b, c, d As Integer a = 4 b = 6 c = 3 d = 1 Dim wsheet As Worksheet Set wsheet = Application.ActiveWorkbook.Sheets(c) Dim wbook As Workbook 'assigns workbook numbers If (d = 1) Then Set wbook = Workbooks.Open("C:\Users\mminchuk\Documents\Updated MaintPrep Sheets\MaintPrep Sheet 1st.xlsm", UpdateLinks:=xlUpdateLinksAlways) Else If (d = 2) Then Set wbook = Workbooks.Open("C:\Users\mminchuk\Documents\Updated MaintPrep Sheets\MaintPrep Sheet 2nd.xlsm", UpdateLinks:=xlUpdateLinksAlways) Else If (d = 3) Then Set wbook = Workbooks.Open("C:\Users\mminchuk\Documents\Updated MaintPrep Sheets\MaintPrep Sheet 3rd.xlsm", UpdateLinks:=xlUpdateLinksAlways) End If End If End If Application.ScreenUpdating = False 'End if it's done with all the workbooks Do Until (d = 4) 'Looks for the sheet that has the same name If (wsheet.Name = currentsheet.Name) Then currentsheet.Cells(b, a) = currentsheet.Cells(b, a) + Workbooks(d).Sheets(c).Cells(b, a) a = a + 1 b = b + 1 If a = 51 Then If b = 99 Then End If End If End If d = d + 1 Loop Application.ScreenUpdating = True End Sub