VBA display message box, pick yes or no

Jack_Mason

New Member
Joined
Nov 19, 2020
Messages
5
Office Version
  1. 2016
Platform
  1. Windows
I have a load of text data which I need to read through to confirm if its relevant or not. I want to display the text from each cell in column D in a message box and then click ‘yes’ or ‘no’ depending on its relevancy and then move onto the next cell down, when i click yes or no i want it to write yes or no in the column next to it so i can filter through this at a later date. Please, can anyone help me with this code?
 

Some videos you may like

Excel Facts

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple

Joe4

MrExcel MVP, Junior Admin
Joined
Aug 1, 2002
Messages
55,916
Office Version
  1. 365
Platform
  1. Windows
Welcome to the Board!

Here is a little example that I think will show you how to do what you want:
VBA Code:
Sub MyMacro()

    Dim response
   
    response = MsgBox("Select Yes or No", vbYesNo)
   
    If response = vbYes Then
        Cells(Rows.Count, "D").End(xlUp).Offset(1, 0) = "Yes"
    Else
        Cells(Rows.Count, "D").End(xlUp).Offset(1, 0) = "No"
    End If
   
End Sub
 

dmt32

Well-known Member
Joined
Jul 3, 2012
Messages
6,374
Office Version
  1. 2019
Platform
  1. Windows
Hi,
try following & see if does what you want


VBA Code:
Sub YesNo()
    Dim rng As Range, cell As Range
    Dim Response As VbMsgBoxResult
    
    Set rng = Range(Range("D1"), Range("D" & Rows.Count).End(xlUp))
    
    For Each cell In rng.Cells
       'optional - highlights each cell
        cell.Select
        Response = MsgBox(cell.Text & Chr(10) & "Relevant?", 35, "Relevance")
        If Response = vbCancel Then Exit Sub
        
        cell.Offset(, 1).Value = IIf(Response = vbYes, "Yes", "No")
        
    Next cell

End Sub

Dave
 
Solution

Jack_Mason

New Member
Joined
Nov 19, 2020
Messages
5
Office Version
  1. 2016
Platform
  1. Windows
Hi,
try following & see if does what you want


VBA Code:
Sub YesNo()
    Dim rng As Range, cell As Range
    Dim Response As VbMsgBoxResult
   
    Set rng = Range(Range("D1"), Range("D" & Rows.Count).End(xlUp))
   
    For Each cell In rng.Cells
       'optional - highlights each cell
        cell.Select
        Response = MsgBox(cell.Text & Chr(10) & "Relevant?", 35, "Relevance")
        If Response = vbCancel Then Exit Sub
       
        cell.Offset(, 1).Value = IIf(Response = vbYes, "Yes", "No")
       
    Next cell

End Sub

Dave
This is perfect! Thank you
 

Jack_Mason

New Member
Joined
Nov 19, 2020
Messages
5
Office Version
  1. 2016
Platform
  1. Windows

ADVERTISEMENT

Welcome to the Board!

Here is a little example that I think will show you how to do what you want:
VBA Code:
Sub MyMacro()

    Dim response
  
    response = MsgBox("Select Yes or No", vbYesNo)
  
    If response = vbYes Then
        Cells(Rows.Count, "D").End(xlUp).Offset(1, 0) = "Yes"
    Else
        Cells(Rows.Count, "D").End(xlUp).Offset(1, 0) = "No"
    End If
  
End Sub
Thank you
 

Joe4

MrExcel MVP, Junior Admin
Joined
Aug 1, 2002
Messages
55,916
Office Version
  1. 365
Platform
  1. Windows
You are welcome.

Glad we could help!
 

Watch MrExcel Video

Forum statistics

Threads
1,122,528
Messages
5,596,690
Members
414,088
Latest member
rodriboraun

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
Top