Charlreena
New Member
- Joined
- Jul 17, 2018
- Messages
- 3
I have a formula that selects an array and then pastes into a database on another worksheet.
Is there a way that the array selection can be from a closed workbook, and then paste the data into the database on my open workbook?
This is my code currently:
Thanks
Is there a way that the array selection can be from a closed workbook, and then paste the data into the database on my open workbook?
This is my code currently:
Code:
Sub CopyData09()
Dim lr As Long, i As Long, cls
cls = Array("D5", "F5", "F19", "K5", "M5", "S5", "M7", "S7", "M9", "S9", "M11", "S11", "M13", "S13", "M15", "S15", "B19", "D19", "H19", "I19", "J19")
With Sheets("JL009")
lr = WorksheetFunction.Max(2, .Range("C" & Rows.Count).End(xlUp).Row + 1)
For i = LBound(cls) To UBound(cls)
.Cells(lr, i + 3).Value = Sheets("Master").Range(cls(i)).Value
If .Cells(lr, i + 3) < 0 Then .Cells(lr, i + 3) = .Cells(lr, i + 3) * -1
If .Cells(lr, i + 3) = "" Then .Cells(lr, i + 3) = 0
Next i
End With
End Sub
Thanks