ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Selecting workbook (https://www.excelbanter.com/excel-programming/307865-selecting-workbook.html)

Lazer[_6_]

Selecting workbook
 
I have two workbooks. I want to delete worksheets from the one that i
not currently active. How do I do that? Right now it keeps deletin
the sheets from the active one...

Thanks!
Elieze

--
Message posted from http://www.ExcelForum.com


Tod[_3_]

Selecting workbook
 
Make sure to refer to the workbook by name. So if the
workbook is called XYZ.xls (I'm so imaginative!), and it
is currently open:

Workbooks("XYZ").Worksheets("Sheet1").Delete

or

Workbooks("XYZ").Worksheets(1).Delete

tod

-----Original Message-----
I have two workbooks. I want to delete worksheets from

the one that is
not currently active. How do I do that? Right now it

keeps deleting
the sheets from the active one...

Thanks!
Eliezer


---
Message posted from http://www.ExcelForum.com/

.


Tom Ogilvy

Selecting workbook
 
Specify the other workbook

workbooks("otherbookname.xls").Worksheets("Sheet3" ).Delete

--
Regards,
Tom Ogilvy

"Lazer " wrote in message
...
I have two workbooks. I want to delete worksheets from the one that is
not currently active. How do I do that? Right now it keeps deleting
the sheets from the active one...

Thanks!
Eliezer


---
Message posted from http://www.ExcelForum.com/




Lazer[_7_]

Selecting workbook
 
Great - thanks!!

--
Message posted from http://www.ExcelForum.com



All times are GMT +1. The time now is 01:15 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com