View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
ADG ADG is offline
external usenet poster
 
Posts: 76
Default Moving Sheets To A Different Workbook XL2003

I did the below mopd and your code worked

Sub Blah()

Dim oActiveSheet As Object
Dim x As Long

Sheets("Duplicate").Copy Befo=Sheets("Duplicate")
Set oActiveSheet = ActiveSheet
x = Workbooks("2006.05.30Presentation.xls").Sheets.Cou nt
oActiveSheet.Move after:=Workbooks("2006.05.30Presentation.xls").She ets(x)

End Sub

--
Tony Green


"Kevin H. Stecyk" wrote:

Hi,

XL 2003, Windows XP.

I have a question regarding moving sheets to a different workbook.

Sub Blah()

Dim oActiveSheet As Object

blah blah blah

Sheets("Duplicate").Copy Befo=Sheets("Duplicate")
Set oActiveSheet = ActiveSheet

oActiveSheet.Move
after:=Workbooks("2006.05.30Presentation.xls").She ets(Sheets.Count)

End Sub

On the last statement, I get a Run-time error '9': Subscript out of range.

Where did I go wrong? The other workbooks is named
"2006.05.30Presentation.xls". I want to move oActiveSheet from WorkbookA to
2006.05.30Presentation.xls at the very end.


Thank you.

Best regards,
Kevin