If Macro

S

Sal

Is there a macro that will say if Column A and Column B on Sheet3 have
contents follow this code…

I am going to put a long code here

But if Column A and Column B do not have contents follow this code

application.displayalerts = false
Sheets("Sheet3").Delete
Sheets("Sheet3a").Delete
application.displayalerts = true

End Sub
 
D

Don Guillett

try

Sub ifcolaandbblank()
If WorksheetFunction.CountA(Columns("a:b")) > 0 Then
'do this
Else
On Error GoTo nono
Application.DisplayAlerts = False
Sheets("sheet3").Delete
Sheets("sheet3a").Delete
Application.DisplayAlerts = True
End If
Exit Sub
nono:
MsgBox "not there"
End Sub--
Don Guillett
Microsoft MVP Excel
SalesAid Software
(e-mail address removed)
 
S

Sal

This is really good stuff. Thank you very much.

Don Guillett said:
try

Sub ifcolaandbblank()
If WorksheetFunction.CountA(Columns("a:b")) > 0 Then
'do this
Else
On Error GoTo nono
Application.DisplayAlerts = False
Sheets("sheet3").Delete
Sheets("sheet3a").Delete
Application.DisplayAlerts = True
End If
Exit Sub
nono:
MsgBox "not there"
End Sub--
Don Guillett
Microsoft MVP Excel
SalesAid Software
(e-mail address removed)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top