$20 USD: Add yes/no message box to code

  • I am lookking to add a yes/no message to box to the following piece of code that I have. I tried a few things but could not get to work. I would like the user prompt to ask the following ? ---> "Would you like to copy the date to column Cozgrid.com/forum/core/index.php?attachment/67422/?". Then if "Yes" is selected, run the following macro. If "No", end the subroutine.


    Code
    1. Sub CopyData()Dim a As Integer
    2. a = Sheets("Sheet1").Range("B" & Rows.Count).End(xlUp).Row
    3. Sheets("Sheet1").Range("B5:B" & a).Copy
    4. Sheets("Sheet1").Range("C5").PasteSpecial xlPasteValues
    5. End Sub
  • Re: $20 USD: Add yes/no message box to code


    OK, just to confirm, you simply want a message box asking the user to confirm they want to copy the data. User selects Yes/No and the code proceeds accordingly?


    If so.

  • Re: $20 USD: Add yes/no message box to code


    I don't, and won't, use PayPal - which is a bit of problem.


    It's not exactly the most complicated code and didn't exactly take a chunk out of my day (night) so let's split it 3 ways: 10% to OzGrid ($2 - Paid), 50% to you for a beer ($10 should get a decent quality one) and the remaining $8.00 plus any change from the beer to a charity of your choice - no confirmation needed, it's between you and your conscience...

  • Re: $20 USD: Add yes/no message box to code


    Thank you cytop! I'm sorry, I only ever used PayPal for payments on this site. Appreciate the beer money and I am going to a charity fundraiser this weekend and will donate the $8 plus much more there.