LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default Sheets.copy problem

These changes should work

Sub othertabs(Inv As Integer)
Dim second_ws As Workbook
Dim Found As Integer
Dim main_ws As Workbook

Set main_ws = ActiveWorkbook
folder = "S:\Iashare\0Subprime\Tracking\AA\"
Filename = Dir(folder & Inv & ".xls")

Workbooks.Open Filename:=folder & Filename

Set second_ws = ActiveWorkbook

For Each ws In second_ws.Sheets
Found = False
For Each mn_ws In ThisWorkbook.Sheets
If second_ws.Name = mn_ws.Name Then
Found = True
Exit For
End If
Next mn_ws
If Found = False Then
With ThisWorkbook
ws.Copy after:=.Sheets(.Sheets.Count)
End With
End If

Next ws
End Sub



"jln via OfficeKB.com" wrote:

It is being called from another subroutine. All of the other Subroutines that
i have are being passed the Inv number

Call othertabs(Inv)

Joel wrote:
Are you calling this subroutine from another subroutine? Other tabs need the
parameter Inv. Make sure you are caling the sub like main below

sub main
Inv = "abc"
call other(Inv)
end sub

Joel

[quoted text clipped - 38 lines]
workbook is already open and it will open the 2nd work book with the tabs i
need to copy from.


--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...mming/200712/1


 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Sheets("Sheet").Copy problem Brian Excel Programming 4 September 14th 07 01:23 PM
Sheets.Copy Error in Excel 2003 - Is this a registry Problem? HamishMcT Excel Programming 3 August 8th 07 05:44 PM
Sheets(array(aryMySheets)).Copy problem!! [email protected] Excel Programming 1 March 22nd 06 10:51 AM
in VBA Sheets("mysheet").Copy Befo=Sheets(1) how do i get a reference to the newly created copy of this sheet? Daniel Excel Worksheet Functions 1 July 6th 05 09:57 PM
Sheets.copy problem Stephen Knapp Excel Programming 0 November 24th 04 03:11 PM


All times are GMT +1. The time now is 10:52 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"