Random Phrase Popup in Excel

photos_tinyfroglet_2316312085 I use a pretty large Excel Workbook every day in my job.  I thought it might be nice to have a “motivational” phrase show each time the workbook was opened.  Something to start the day out on the right foot.

In my workbook I created a worksheet called phrases that simply consist of a motivational phrase on each row.  You can have as many of them as you want.  I then went into the VBA Editor (Alt+F11) and inserted this little snippet of code into “This Wookbook”.  Now each time I open the workbook I get a random phrase off of my phrases worksheet.

 

Photo courtesy of: tinyfroglet

Private Sub Workbook_Open()

   Dim MyValue

      With Worksheets(”PHRASES”)

         LR = .Cells(.Rows.Count, “A”).End(xlUp).Row

         Randomize

         MyValue = Int((LR * Rnd) + 1)

         MsgBox (.Cells(MyValue, “A”)), vbOKOnly, “Thought of the Day”

      End With

End Sub

About the Author

Bill

Leave a Reply

You can use these XHTML tags: <a href="" title=""> <abbr title=""> <acronym title=""> <blockquote cite=""> <code> <em> <strong>