S
Snoopy
Hey guys
I've made a summary-file to collect data from several files in a
commen folder.
So far I've hardcoded my macro to pick up the datas from every singel-
named file.
The same prosedyre is used on every singel file.
This must be wiser to perform this by using a loop-statement...but
how?
There are 9 separate files to handle (I show my reference to the 2 of
them)
Some of the files may be protected by password.
Are there any way to "tell" the macro to still open it?
When running my primitiv macro a messagebox pops up and say there is a
lot of copyed data on the clipboard. I want the macro to run through
the lot whithout stopping.
How do I do this?
I will be very thankfull for your help
Regards
Snoopy
The tricky part of my macro:
'Merk "Petter - protected file - opens with password: "123"
Application.StatusBar = "Petter"
Workbooks.Open Filename:="E:\Petter.xls"
Sheets("Register").Select
Range("A2").Select
On Error Resume Next
ActiveSheet.ShowAllData
On Error GoTo 0
Set tbl = ActiveCell.CurrentRegion
tbl.Offset(1, 0).Resize(tbl.Rows.Count - 1, _
tbl.Columns.Count).Select
Selection.Copy
Range("A2").Select
Windows("Rapport.xls").Activate
Sheets("Samlet").Select
Selection.Offset(0, 0).Range("A1").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
Selection.PasteSpecial Paste:=xlPasteFormats, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False
Selection.End(xlDown).Select
Selection.Offset(1, 0).Range("A1").Select
Windows("Petter.xls").Activate
ActiveWindow.Close
'Merk "Rita"
Application.StatusBar = "Rita"
Workbooks.Open Filename:="E:\Rita.xls"
Sheets("Register").Select
Range("A2").Select
On Error Resume Next
ActiveSheet.ShowAllData
On Error GoTo 0
Set tbl = ActiveCell.CurrentRegion
tbl.Offset(1, 0).Resize(tbl.Rows.Count - 1, _
tbl.Columns.Count).Select
Selection.Copy
Range("A2").Select
Windows("Rapport.xls").Activate
Sheets("Samlet").Select
Selection.Offset(0, 0).Range("A1").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
Selection.PasteSpecial Paste:=xlPasteFormats, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False
Selection.End(xlDown).Select
Selection.Offset(1, 0).Range("A1").Select
Windows("Rita.xls").Activate
ActiveWindow.Close
'Merk "Sidsel"
Application.StatusBar = "Sidsel"
Workbooks.Open Filename:="E:\sidsel.xls"
Sheets("Register").Select
Range("A2").Select
On Error Resume Next
ActiveSheet.ShowAllData
On Error GoTo 0
Set tbl = ActiveCell.CurrentRegion
tbl.Offset(1, 0).Resize(tbl.Rows.Count - 1, _
tbl.Columns.Count).Select
Selection.Copy
Range("A2").Select
Windows("Rapport.xls").Activate
Sheets("Samlet").Select
Selection.Offset(0, 0).Range("A1").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
Selection.PasteSpecial Paste:=xlPasteFormats, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False
Selection.End(xlDown).Select
Selection.Offset(1, 0).Range("A1").Select
Windows("sidsel.xls").Activate
ActiveWindow.Close
I've made a summary-file to collect data from several files in a
commen folder.
So far I've hardcoded my macro to pick up the datas from every singel-
named file.
The same prosedyre is used on every singel file.
This must be wiser to perform this by using a loop-statement...but
how?
There are 9 separate files to handle (I show my reference to the 2 of
them)
Some of the files may be protected by password.
Are there any way to "tell" the macro to still open it?
When running my primitiv macro a messagebox pops up and say there is a
lot of copyed data on the clipboard. I want the macro to run through
the lot whithout stopping.
How do I do this?
I will be very thankfull for your help
Regards
Snoopy
The tricky part of my macro:
'Merk "Petter - protected file - opens with password: "123"
Application.StatusBar = "Petter"
Workbooks.Open Filename:="E:\Petter.xls"
Sheets("Register").Select
Range("A2").Select
On Error Resume Next
ActiveSheet.ShowAllData
On Error GoTo 0
Set tbl = ActiveCell.CurrentRegion
tbl.Offset(1, 0).Resize(tbl.Rows.Count - 1, _
tbl.Columns.Count).Select
Selection.Copy
Range("A2").Select
Windows("Rapport.xls").Activate
Sheets("Samlet").Select
Selection.Offset(0, 0).Range("A1").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
Selection.PasteSpecial Paste:=xlPasteFormats, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False
Selection.End(xlDown).Select
Selection.Offset(1, 0).Range("A1").Select
Windows("Petter.xls").Activate
ActiveWindow.Close
'Merk "Rita"
Application.StatusBar = "Rita"
Workbooks.Open Filename:="E:\Rita.xls"
Sheets("Register").Select
Range("A2").Select
On Error Resume Next
ActiveSheet.ShowAllData
On Error GoTo 0
Set tbl = ActiveCell.CurrentRegion
tbl.Offset(1, 0).Resize(tbl.Rows.Count - 1, _
tbl.Columns.Count).Select
Selection.Copy
Range("A2").Select
Windows("Rapport.xls").Activate
Sheets("Samlet").Select
Selection.Offset(0, 0).Range("A1").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
Selection.PasteSpecial Paste:=xlPasteFormats, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False
Selection.End(xlDown).Select
Selection.Offset(1, 0).Range("A1").Select
Windows("Rita.xls").Activate
ActiveWindow.Close
'Merk "Sidsel"
Application.StatusBar = "Sidsel"
Workbooks.Open Filename:="E:\sidsel.xls"
Sheets("Register").Select
Range("A2").Select
On Error Resume Next
ActiveSheet.ShowAllData
On Error GoTo 0
Set tbl = ActiveCell.CurrentRegion
tbl.Offset(1, 0).Resize(tbl.Rows.Count - 1, _
tbl.Columns.Count).Select
Selection.Copy
Range("A2").Select
Windows("Rapport.xls").Activate
Sheets("Samlet").Select
Selection.Offset(0, 0).Range("A1").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
Selection.PasteSpecial Paste:=xlPasteFormats, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False
Selection.End(xlDown).Select
Selection.Offset(1, 0).Range("A1").Select
Windows("sidsel.xls").Activate
ActiveWindow.Close