import data closed workbook

Public Schedule Face-to-Face & Online Instructor-Led Training - View dates & book

Forum home » Delegate support and help forum » Microsoft Excel VBA Training and help » Import data from a closed workbook

Import data from a closed workbook

resolvedResolved · Medium Priority · Version 2003

Daren has attended:
Excel VBA Intro Intermediate course

Import data from a closed workbook

I require an excel sheet to inport data from another closed workbook
The programming below works fine, but the source date is currently placed within the active workbook, called "AreaName".
The information needs to be imported from the sheet1 on a closed Excel workbook

Can you help, Thank you


I nPublic Sub CmdButtonOK_Click()

SiteName = CmbSiteSelect

intTargetRowCount = 80 'This is the row 10 were the information is placed.

IntNumRows = Sheets(AreaName).Range("A2").CurrentRegion.Rows.Count
'Using 'current Region' selects the all the data starting from cell A on the 2nd
'row to the end of the data i,e to cell "J526"

For introwcount = 1 To IntNumRows 'This tell the count to move along by cell

If Sheets(AreaName).Range("A2").Cells(introwcount, 11).Value = SiteName Then
'look for the specified name, in row 11, in the range from cell A2 in the
'worksheet 'Poplar'.

For intcolumnCount = 8 To 23

Sheets("DataSheet").Cells(intTargetRowCount, intcolumnCount - 7).Value = _
Sheets(AreaName).Range("A2").Cells(introwcount, intcolumnCount).Value

Next intcolumnCount

intTargetRowCount = intTargetRowCount + 1

End If

Next introwcount

Unload UserForm1eed it

RE: Import data from a closed workbook

Hi Daren

Thanks for your post, I will need to run this by one of our VBA trainers, they are extremely busy at the moment but hope to catch up later today so we should be able to let you know if we can assist by tomorrow.

Kind regards

Jacob

RE: Import data from a closed workbook

Hi Darren

I have discussed your post with one of my colleagues and to be reasonably confident we can assist will be beyond the scope of this forum.

I shall contact you directly so that you can send me a copy of your working file.

We can have a look at possible solutions, this may incur some development time, but we will let know first.

Kind regards

Jacob

 

Training courses

 

Training information:

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
What does 'Resolved' mean?

Any suggestions, questions or comments? Please post in the Improve the forum thread.


 

Excel tip:

Calculate age or service

The DATEDIF() function in Excel calculates the number of days, months, or years between two dates. So, this function makes it easy to calculate a person's age. To try this tip:

In a blank worksheet, type the birth date in cell A1, using slashes to separate day, month, and year.
In cell A2, type =DATEDIF(A1,TODAY(),"y") and press ENTER.

View all Excel hints and tips


Server loaded in 0.08 secs.