ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Deleting rows from all sheets in an array? (https://www.excelbanter.com/excel-programming/382312-deleting-rows-all-sheets-array.html)

AVR

Deleting rows from all sheets in an array?
 
I am trying to delete the same specified rows from a each sheet within a
collection of sheets in a workbook. Using code analogous to the following,
I'm getting a error.
If this is incorrect, is there a way to do it without actually "selecting"
the different sheets?

Sheets(Array("A", "B","C","D","E","F") ).Rows("5:10").Delete

Thanks

Ron de Bruin

Deleting rows from all sheets in an array?
 
Hi AVR

Try this

Dim sh As Worksheet
For Each sh In Sheets(Array("A", "B", "C", "D", "E", "F"))
sh.Rows("5:10").Delete
Next sh


--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"AVR" wrote in message ...
I am trying to delete the same specified rows from a each sheet within a
collection of sheets in a workbook. Using code analogous to the following,
I'm getting a error.
If this is incorrect, is there a way to do it without actually "selecting"
the different sheets?

Sheets(Array("A", "B","C","D","E","F") ).Rows("5:10").Delete

Thanks



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

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