I have an array that consists of static cells in variable workbooks.
When I copy them to the active workbook, there are fewer cells than were in the original array. So 39 cells in the array being rolled into 33 cells as an example.
Is there a way to sum the cells in the array like this?
Array("C6" + "C7","C8","C9")?
Example Sheets
Source from external workbook:
What I actually want result to look like:
In my code I am trying to modify the cls array so "C6" would be "C6+C7" or something:
Option Explicit
Sub ImportData()
Dim B1 As Workbook
Dim B2 As Workbook
Dim S1 As Range
Dim cls As Variant, LR As Long, i As Long
Set B1 = ActiveWorkbook
cls = Array("C3", "C4", "C5", "C6", "C7", "C10", "C11", "C12", "G12")
With Application.FileDialog(msoFileDialogOpen)
.Filters.Clear
.Filters.Add "Excel Files", "*.xlsx*;*.xlsm*;*.xlsa*;*.xm*"
.AllowMultiSelect = False
.Show
If .SelectedItems.Count > 0 Then
Workbooks.Open .SelectedItems(1)
Set B2 = ActiveWorkbook
Set S1 = Application.InputBox(prompt:="Select source sheet (select any cell)", Title:="Source sheet", Default:="A1", Type:=8)
With B1.Sheets("Sheet2")
For i = LBound(cls) To UBound(cls)
.Range("C4").Offset(, i).Value = S1.Parent.Range(cls(i)).Value
Next i
.Range("C4:K4").EntireColumn.AutoFit
End With
B2.Close False
End If
End With
End Sub
Thanks in advance.


