98.7% Of all customers recommend us, we're so confident about our results we publish all reviews and stats
View Live Stats View ReviewsForum home » Delegate support and help forum » Microsoft Excel Training and help » VBA
VBA
Resolved · Low Priority · Version 2016
Jiyu has attended:
Excel VBA Intermediate course
Excel VBA Introduction course
VBA
Can I use VBA to retrieve data from other workbooks without needing to open those workbooks?
RE: VBA
Hi Jiyu,
Thank you for the question and I hope you are fine.
Below you can find an example. In my example the code will open a workbook, get the data, and close the workbook we have retrieved the data from. I hope the example makes sense.
Sub Example1()
Dim objWorkbook As Workbook
Dim i As Integer
'open the workbook with data
Set objWorkbook = Workbooks.Open( _
"D:StuffBusinessTempData.xlsx")
'read the data from the first columns
For i = 1 To 9
Cells(i, 1) = _
objWorkbook.Worksheets("Sheet1").Cells(i + 1, 1)
Next i
'close the workbook
objWorkbook.Close
End Sub
Kind regards
Jens Bonde
Microsoft Office Specialist Trainer
Tel: 0207 987 3777
STL - https://www.stl-training.co.uk
98%+ recommend us
London's leader with UK wide delivery in Microsoft Office training and management training to global brands, FTSE 100, SME's and the public sector
Training information:
See also:
Welcome. Please choose your application (eg. Excel) and then post your question. Our Microsoft Qualified trainers will then respond within 24 hours (working days). Frequently Asked Questions
Any suggestions, questions or comments? Please post in the Improve the forum thread. |
Excel tip:Stop Formula Returning A "#DIV/0" ErrorIf a formula returns a #DIV/0 error message there is a way to avoid such results. |