LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 69
Default If Then to delete sheet if B1 blank

Excel 2003 SR2

I'm moving a large file into row range worksheets (5000 lines go into each
worksheet) which is then tested for blanks in Column B. If there are blanks
the row is deleted. Then I test to see if the worksheets past the 20000th
row are blank (B1 will always be blank if the whole worksheet is blank). If
true, delete the worksheet without displaying the warning.

My problem is the code (below) deletes the worksheet whether B1 is blank or
not ! I've cut and pasted other examples to get this formula and probably
did not cut enough or paste enough.

Any help would be appreciated!

CaroleO

If IsEmpty(Worksheets("20000").Range("B1")) Then
Application.DisplayAlerts = False
Sheets("20000").Delete
Application.DisplayAlerts = True
Else
Sheets("20000").Select
Columns("B:B").Select
Selection.SpecialCells(xlCellTypeBlanks).Select
Selection.EntireRow.Delete
End If
If IsEmpty(Worksheets("25000").Range("B1")) Then
Application.DisplayAlerts = False
Sheets("25000").Delete
Else
Sheets("25000").Select
Columns("B:B").Select
Selection.SpecialCells(xlCellTypeBlanks).Select
Selection.EntireRow.Delete
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Delete blank sheet linglc Excel Programming 6 July 4th 06 01:51 PM
"BLANK" - need to delete anjgoss Excel Worksheet Functions 3 August 25th 05 05:31 PM
Delete blank row only if 2 consecutive blank rows Amy Excel Programming 2 October 21st 04 05:24 PM
Macro to look for blank rows in sheet, delete the row and autofit JDerm Excel Programming 1 May 13th 04 07:08 PM


All times are GMT +1. The time now is 11:35 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"