1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Hi Guest, welcome to the TES Community!

    Connect with like-minded education professionals and have your say on the issues that matter to you.

    Don't forget to look at the how to guide.

    Dismiss Notice

An Excel VBA Coding Joke

Discussion in 'Computing and ICT' started by Richard_Finnigan, Jan 24, 2012.

  1. I had my Year 7 class in stitches today with this user defined function, God knows where it come from we just ran with the idea. . . . A spreadsheet that wants to be your friend :) It covers some pretty good IT as well. After they have made it using their own function and variable names if they want to (differentiation) I will ask them to annotate in order to explain what each line of code is doing.
    Public Function beMyFriend() As String
    Dim i As Integer
    Dim Repsonse As String
    Do Until response = "Yes"
    response = InputBox("Hi", "Be my friend please.")
    If response <> "Yes" Then
    MsgBox "BOO HOO I HATE YOU!!"
    End If
    Loop

    beMyFriend = "I Love You MWA XXX <3"
    End Function
     
  2. BTW The third line should be "Dim Response As String"
     

Share This Page