Closed Workbooks ... can you??????

dbrull

Board Regular
Joined
Jun 25, 2002
Messages
71
I will have 10 workbooks that on a monthly basis, will need to have data copied and put into a master workbook.

I read that you can get data from a closed workbook, but my workbooks will have passwords. Does this matter?

Also i need to be able to copy only one months data, not all. While the workbook is closed, can i run a macro in it to select only the data i want?

thanks
 

Excel Facts

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.
On 2002-08-26 09:58, dbrull wrote:
I will have 10 workbooks that on a monthly basis, will need to have data copied and put into a master workbook.

Is the data in the Same sheet and Range?

I read that you can get data from a closed workbook, but my workbooks will have passwords. Does this matter?

No as long as you know the password, are they
the same for each workbook

Also i need to be able to copy only one months data, not all. While the workbook is closed, can i run a macro in it to select only the data i want?

thanks

This is doable but...you will need to do a bit
of work......what have you got so far..

To get you thinking in the right direction
here is a routine that gets Values from a set range from ALL xlfiles in a certain Dir.

<pre/>
Sub GetValue_ViaFormula()
Dim sDir As String
Dim ShtCellLoc As String
Dim DRg As Range
Dim Files
Dim x As Double

'This is the Dir to search in
sDir = "C:Excelfiles"
'This is the Location/cell address
ShtCellLoc = "Sheet1'!$A$1"

Files = Dir(sDir & "*.xls")

'Clear area Column A to place data in
'Change this as required
Columns("A:A").Clear

'speed things up
Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual

x = 1
On Error GoTo FileError
Do While Len(Files) > 0
Cells(x, 1) = Files
Cells(x, 2) = "='" & sDir & "[" & Files & "]" & ShtCellLoc
x = x + 1
Files = Dir()
Loop
Application.Calculate
Set DRg = Range(Range("A1:B1"), Range("A1:B1").End(xlDown)) '.Copy
DRg.Copy
DRg.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:=False, Transpose:=False
Columns("A:B").Columns.EntireColumn.AutoFit
Application.CutCopyMode = False

Set DRg = Nothing

Application.Calculation = xlCalculationAutomatic
Application.Calculate
Application.ScreenUpdating = True

MsgBox "Done!"

Exit Sub
FileError:
MsgBox Err.Number & Chr(13) & _
Err.Description & Chr(13) _
, vbCritical + vbMsgBoxHelpButton, _
"File Error", _
Err.HelpFile, _
Err.HelpContext
End Sub
</pre>
 
Upvote 0

Forum statistics

Threads
1,214,651
Messages
6,120,738
Members
448,988
Latest member
BB_Unlv

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