Retrieve a data from other workbook

urielp

New Member
Joined
Nov 18, 2013
Messages
10
Hello,

I have a database in a range on Personal.xlsb workbook, in Sheet1. I would like to retreive the data from the other columns, using VBA.
I have this code. It works only while Personal.xlsb is activated. While I activate other workbook, I'm getting an error message (application defined or object defined error).

1. How to solve this issue?
2. Additional question: I would like to lookup the data in this range. For example, I would like to search for 'mrr factor' (row 7) using VBA. If found, to retreive the rest of the columns related to this row. How to do this? Note that Peronal.xlsb workbook is hidden.

Thanks,
Uriel

VBA Code:
Sub VBALookup()
Dim dRng As Range
Set dRng = Workbooks("personal.xlsb").Worksheets("sheet1").Range("A2", [A2].End(xlDown))
Set wsCopy = Workbooks("personal.xlsb").Worksheets("sheet1").Range("A2", [A2].End(xlDown))
Dim cel As Range
For Each cel In wsCopy.Cells
    pol = cel.Offset(0, 4).Value
Next cel
End Sub
 

Attachments

  • Database.png
    Database.png
    38.5 KB · Views: 5

Excel Facts

When they said...
When they said you are going to "Excel at life", they meant you "will be doing Excel your whole life".

Forum statistics

Threads
1,215,368
Messages
6,124,523
Members
449,169
Latest member
mm424

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