Hello, the following macro goes into 4 workbooks and pastes the data into the current macro workbook cells A1, A2, A3, A4. I know how to manipulate whether the code starts at A2, A3, etc, by changing the "Cells (i+1,1)" to "Cells (i+2,1)", but my question is how do I manipulate the code to paste the data in A1, B1, C1, D1? Thanks!
![]()
Sub test() Dim wbNames, i As Long Const ws As String = "Trial Balance" Const myDir As String = "c:\Users\rhoover\" wbNames = Array("Cudahy Center 06.17.xlsx", "Wellington Park 06.17.xlsx", "Wausau 06.17.xlsx", "Forest Plaza 06.17.xlsx") For i = 0 To UBound(wbNames) Cells(i + 1, 1).Formula = "=sum('" & myDir & "[" & wbNames(i) & "]" & ws & "'!c:c)/2" Next Range("A1:A4").Select Selection.Copy Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _ :=False, Transpose:=False Application.CutCopyMode = False Range("A1:A4").Select Selection.Style = "Comma" Range("A1").Select End Sub
Bookmarks