View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
anan[_2_] anan[_2_] is offline
external usenet poster
 
Posts: 1
Default Help:loop on two workbooks


Hi,

I am trying to loop on each sheet in a workbook. If any sheet o
interest is found, I need to copy the sheet into another workbook. M
code looks like as follows, but I keep getting error message "subscrip
out of range". Anyone could help me out. Thanks in advance.

For Each ws In ActiveWorkbook.Worksheets
i = 1
For i = 1 To 20
If ws.Name = Copy_list(i) Then

ws.Copy Befo=Workbooks _
("aa").Sheets(1)
Windows("bb").Activate
End If
Next
Nex

--
ana
-----------------------------------------------------------------------
anan's Profile: http://www.excelforum.com/member.php...fo&userid=2426
View this thread: http://www.excelforum.com/showthread.php?threadid=48369