One button, two functions? Excel

cantona_007

New Member
Joined
Aug 1, 2012
Messages
19
So I have a macro button in my worksheet that sends a specific range of cells as an email, I also have another button that resets the fields of those cells when the email has been sent. I was wondering if there’s a way I could combine those two functions to just one button. So in essence, I want to be able to just click the one button and it’ll send the email, as well as reset the cells.</SPAN>
I've tried everything i know with VBA codes but, no luck!

Is this even possible?... thanks for your help.</SPAN>
Cheers!</SPAN>
 
Hello cantona_007,

Yes, this is possible. It just all depends on the order / the way you choose to nest your lines of code. For instance:

Code:
Sub EmailRange()

ActiveSheet.Range("A1").Select
ActiveWorkbook.EnvelopeVisible = True
With ActiveSheet.MailEnvelope
  .Item.To = johnsmith@yahoo.com
  .Item.Subject = "Test"
  .Item.Send
End With

'place remainder of your code here

End Sub

The action above will select a range and then e-mail out the specs.

You will want to substitute in your code after the send function has released.

Hope this makes sense.
 
Upvote 0

Forum statistics

Threads
1,226,854
Messages
6,193,369
Members
453,792
Latest member
Vic001

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top