H
hawki
I have opened a number of workbooks, "wk01" through "wkXX". I have opened
another workbook, "info" , to collect information from "wk01" to "wkXX", copy
the information, paste to workbook "info" one at a time, and close each of
the "wkXX's" after the information is collected.
I must perform the procedure a number of times based on the number of
workbooks open less (subtract) 1. My workbook "info" where the informaton is
collected is closed when the routine is complete. The workbook "info" is the
last to close.
The following code does not work for me.
How can I perform the loop based on the number of workbooks open less 1?
Sub test()
Number = Workbooks.Count - 1
ActiveWindow.ActivateNext
For Count = 1 To Number
Range("b1:b5").Copy
Workbooks("info.xls").Activate
Range("a1").Select
ActiveCell.End(xlDown).Offset(1, 0).Select
ActiveCell.PasteSpecial xlPasteValues
ActiveWindow.ActivateNext
ActiveWindow.Close savechanges:=False
Next Count
End Sub
l-hawk
another workbook, "info" , to collect information from "wk01" to "wkXX", copy
the information, paste to workbook "info" one at a time, and close each of
the "wkXX's" after the information is collected.
I must perform the procedure a number of times based on the number of
workbooks open less (subtract) 1. My workbook "info" where the informaton is
collected is closed when the routine is complete. The workbook "info" is the
last to close.
The following code does not work for me.
How can I perform the loop based on the number of workbooks open less 1?
Sub test()
Number = Workbooks.Count - 1
ActiveWindow.ActivateNext
For Count = 1 To Number
Range("b1:b5").Copy
Workbooks("info.xls").Activate
Range("a1").Select
ActiveCell.End(xlDown).Offset(1, 0).Select
ActiveCell.PasteSpecial xlPasteValues
ActiveWindow.ActivateNext
ActiveWindow.Close savechanges:=False
Next Count
End Sub
l-hawk