Array Selection from Closed Workbook

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:

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
 

Excel Facts

Format cells as time
Select range and press Ctrl+Shift+2 to format cells as time. (Shift 2 is the @ sign).

Forum statistics

Threads
1,224,825
Messages
6,181,191
Members
453,021
Latest member
pingpong7117

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top