Tuesday, April 16, 2024
HomeExcel TutorialsExcel for Valentine's Day - How to Tell Your True Love What...

Excel for Valentine’s Day – How to Tell Your True Love What You Think Using Excel Macros

Want an original way to tell your loved one that you love him/her this Valentine’s Day? Why not email them a workbook with a pop-up message! When your sweetheart opens the workbook, they will see a message telling them your true feelings.

Here’s how it works:

1) Create an Excel workbook.

2) Press ALT + F11 to go into the Visual Basic code editor.

3) On the left-hand side of the code editor you’ll see Project Explorer (if you can’t see this, press CTRL + R to open it).

4) You should see the workbook name on the left, with Sheet1, Sheet2, Sheet3 and ThisWorkbook beneath it. Double-click on ThisWorkbook to attach code to one of the event’s in the workbook’s life (in this case, what happens when you open it).

5) You see two drop-down arrows at the top of the code window. Click on the left one (which currently says General) and choose Workbook instead (the only other possible option).

6) You can now see the following code:

Private Sub Workbook_Open()

End Sub

Between these two lines of code, type in a command to display a message. Something like this would do:

MsgBox “I love you!”

For a slightly more impressive system, ask your loved one whether they’ll be your Valentine:

Private Sub Workbook_Open()

Dim Answer As Long

Answer = MsgBox(“Will you be my Valentine?”, vbQuestion + vbYesNo, “Valentine’s Day”)

If Answer = vbYes Then

MsgBox “Then I’ll be yours!”, vbExclamation + vbOKOnly

Else

MsgBox “Oh…”, vbExclamation + vbOKOnly

End If

End Sub

Good luck!



Source by Andy J Brown

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -

Most Popular

Recent Comments