Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
To all,
I have a series of worksheets that I am performing calculations on. However some of them only have two rows of data, and I don't want these workskeets. How can I write a macro that will search through my worksheets, and delete all of the ones with two rows of data or less? I don't know if this is possible, but any help would be appreciated. Thanks Regards Joseph Crabtree |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi joecrabtree
Basic example is this, there is no error check if all sheets have 2 rows or less rows with data. You can't delete all sheets in a workbook Also the UsedRange can be bigger then you think But see if this is working for you Sub test() Dim sh As Worksheet For Each sh In ThisWorkbook.Worksheets If sh.UsedRange.Rows.Count < 3 Then Application.DisplayAlerts = False sh.Delete Application.DisplayAlerts = True End If Next sh End Sub -- Regards Ron de Bruin http://www.rondebruin.nl "joecrabtree" wrote in message ps.com... To all, I have a series of worksheets that I am performing calculations on. However some of them only have two rows of data, and I don't want these workskeets. How can I write a macro that will search through my worksheets, and delete all of the ones with two rows of data or less? I don't know if this is possible, but any help would be appreciated. Thanks Regards Joseph Crabtree |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Delete all rows below certain value on multiple worksheets? | Excel Discussion (Misc queries) | |||
compare two worksheets and delete rows | Excel Programming | |||
Add or Delete Rows in Protected worksheets | Excel Discussion (Misc queries) | |||
delete rows from multiple worksheets | Excel Worksheet Functions | |||
Using VBA to delete certain worksheets rows | Excel Programming |