jsc0624
04-17-2007, 05:54 PM
Is this code correct? What's wrong with this code?
I want to delete a certain column if it is totally blank...
let's say column b is empty then the program will automatically delete it.
But then if it contains 1 or more data, then the program will prompt a msgbox that says, "Do you want to delete?" If the user decided to delete the column and press ok the column will be deleted but if the user press the cancel button, the program will do nothing.
Here is the code:
MsgBox "Are you sure you want to delete this column?", vbOKCancel
If vbOKCancel = True Then
theWhole = Application.CountA(ActiveSheet.Range("b:b"))
Else
'do nothing
End If
I want to delete a certain column if it is totally blank...
let's say column b is empty then the program will automatically delete it.
But then if it contains 1 or more data, then the program will prompt a msgbox that says, "Do you want to delete?" If the user decided to delete the column and press ok the column will be deleted but if the user press the cancel button, the program will do nothing.
Here is the code:
MsgBox "Are you sure you want to delete this column?", vbOKCancel
If vbOKCancel = True Then
theWhole = Application.CountA(ActiveSheet.Range("b:b"))
Else
'do nothing
End If