Excel 2003

N

Neil Holden

Is it possible to clear a range of cells so that it defaults back to template
once the user clicks the button, below is code to attach the excel woorkbook
in an email and once emails i want it to clear certain cells.


Sub Mail_Button66_Click()
'Working in 97-2007
Dim wb As Workbook
Set wb = ActiveWorkbook

If Val(Application.Version) >= 12 Then
If wb.FileFormat = 51 And wb.HasVBProject = True Then
MsgBox "There is VBA code in this xlsx file, there will be no
VBA code in the file you send." & vbNewLine & _
"Save the file first as xlsm and then try the macro
again.", vbInformation
Exit Sub
End If
End If

On Error Resume Next
wb.SendMail "", _
"This is the Subject line"
On Error GoTo 0



End Sub
 
J

Jacob Skaria

Do you mean
'For Contiguous range
Range("A1:A10").Clear

'For non-contiguous range
Range("A1,B2,C3").Clear
 
N

Neil Holden

Do i place that at the bottom of my code? i need it to automatically clear
once the file is attached?
 

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