Hi all,

In the code below I am using the Worksheets().Range() method to delete blank rows. What would be the code that when I manually select a column on whichever worksheet I choose all blank rows will be deleted? This code as it stands now is working for Worhsheet(1), but I can't go to Worksheet(2) without changing the code.

Also, I would like to put in a vbYesNo to save the worksheet. I want to ask if the user wants to save the changes. If not the changes are cancelled. How would I do this?

Thanks in advance,

JDB


Option Explicit
Dim Msg As String
Dim Ans As Integer


Sub DeleteNullRows()
Msg = "You are about to delete blank rows " & vbNewLine
Msg = Msg & "Do you wish to continue?"
Ans = MsgBox(Msg, vbYesNo)
If Ans = vbNo Then Exit Sub

Worksheets(1).Range("A:A").SpecialCells(xlCellTypeBlanks).EntireRow.Delete (xlShiftUp)

End Sub