I am trying to insert a worksheet from file into an open workbook with VBA
code. I was wandering what the code needs to look like.
Thanks
I am trying to insert a worksheet from file into an open workbook with VBA
code. I was wandering what the code needs to look like.
Thanks
"manillla" <manillla@discussions.microsoft.com> wrote in message
news:FBEF1BE5-6585-4260-A132-2E906AAD1247@microsoft.com...
>I am trying to insert a worksheet from file into an open workbook with VBA
> code. I was wandering what the code needs to look like.
> Thanks
Hi Manilla
Try something like:
Sub Tester()
Workbooks("Book1.xls").Sheets("YourSheetName").Copy _
After:=Workbooks("Book2.xls"). _
Sheets(Workbooks("Book2").Sheets.Count)
End Sub
---
Regards,
Norman
Hi Manilla,
> Sub Tester()
>
> Workbooks("Book1.xls").Sheets("YourSheetName").Copy _
> After:=Workbooks("Book2.xls"). _
> Sheets(Workbooks("Book2").Sheets.Count)
> End Sub
should have read:
Sub Tester()
Workbooks("Book1.xls").Sheets("YourSheetName").Copy _
After:=Workbooks("Book2.xls"). _
Sheets(Workbooks("Book2.xls").Sheets.Count)
End Sub
(The ".xls" was missing from the last instance of "Book2").
---
Regards,
Norman
"Norman Jones" <normanjones@whereforartthou.com> wrote in message
news:unciRQHcFHA.220@TK2MSFTNGP10.phx.gbl...
> "manillla" <manillla@discussions.microsoft.com> wrote in message
> news:FBEF1BE5-6585-4260-A132-2E906AAD1247@microsoft.com...
>>I am trying to insert a worksheet from file into an open workbook with VBA
>> code. I was wandering what the code needs to look like.
>> Thanks
>
>
> Hi Manilla
>
> Try something like:
>
> Sub Tester()
>
> Workbooks("Book1.xls").Sheets("YourSheetName").Copy _
> After:=Workbooks("Book2.xls"). _
> Sheets(Workbooks("Book2").Sheets.Count)
> End Sub
>
> ---
> Regards,
> Norman
>
>
>
>
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks