+ Reply to Thread
Results 1 to 2 of 2

Simple solution?

  1. #1
    Forum Contributor
    Join Date
    01-06-2004
    Posts
    121

    Simple solution?

    Is there a way that I can have an alert box (Message box) that provides a "Yes" or "No" option?

    I want the code below to cause the message box to show YES & NO buttons that link to a certain cell giving a "1" for yes and a "2" for no.

    S'possible?

    Sub OptionButton69_Click()
    With ActiveSheet
    If Range("T6").Value = "1" Then
    msg = "Has payment been made?"
    MsgBox msg, vbOKOnly, "ATTENTION!"
    End If
    End With
    End Sub

  2. #2
    Forum Expert dominicb's Avatar
    Join Date
    01-25-2005
    Location
    Lancashire, England
    MS-Off Ver
    MS Office 2000, 2003, 2007 & 2016 365
    Posts
    4,867

    Smile

    Good morning Josiah

    Certainly is. The code below will put a 1 or a 2 in cell A1 depending on whether you select yes or no.

    Sub Message()
    Response = MsgBox("This is an example. Select yes or no.", vbYesNo, "Example")
    If Response = vbYes Then
    Range("A1").Select
    ActiveCell.FormulaR1C1 = "1"
    Exit Sub
    Else
    Range("A1").Select
    ActiveCell.FormulaR1C1 = "2"
    End If
    End Sub

    HTH

    DominicB

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1