Posts by radioflyer54

    Again using help found in these posts and in questions that the super helpers in this forum provided (thanks guys - you are great!) I have created an big upgrade to the Blackjack game found in the "Games" section of this forum.


    The file is too large to add to this post, so send me a note (Radioflyer54) to get your open copy!


    The game is based on the original realization by Carlos Rondäo - he had great cards in his version, so I added new features and transcribed the original code written in Portuguese. You can see more details in the comments for the Blackjack game found in the Games section.


    The code is well commented English so should be comprehensible for most readers.


    I would greatly appreciate any feedback on the code - to make it more efficient, effective or whatever. Permission is granted to use the code anyway you want with the exception of for commercial purposes.

    Using a lot of information found in the help posts, I have created a nifty Sudoko solver that is quite compact, fast and solves (reportedly) the world's toughest Sudoku challenge!


    The file is too large to add to this post, so send me a note (Radioflyer54) to get your open copy!


    The file comes preloaded with the IA Escargot puzzle, according to sources on the internet to have been developed by a Finnish (uh - that would be Finnish and NOT fiendish) mathematician Arto Inkala, that took him three months to design (although personally I have browsed some 18 clue puzzles which I found to be much tougher!).


    The code is well commented English so should be comprehensible for most readers.


    I would greatly appreciate any feedback on the code - to make it more efficient, effective or whatever. Permission is granted to use the code anyway you want with the exception of for commercial purposes.

    I have a spreadsheet with a defined range where a user can input values into any of the cells.


    The idea is to lock cells with existing data and allow data entry into blank cells.
    I have a routine that searches the grid and turns on Locked whenever it finds data.



    I can invoke protection for the spreadsheet and there are lots of options in invoking protection. In fact I use one - Allow Formatting of Cells (see below).


    However if you Manually invoke protection, the first two options are "Select Locked Cells" and "Select Unlocked Cells". I routinely prohibit to select locked cells and allow select unlocked cells.


    When I invoke Protection in the VB code - it defaults to allowing the selection of both locked and unlocked cells.


    Code
    1. ActiveSheet.Protect AllowFormattingCells:=True


    I would like to keep the user to select only the unlocked empty cells. Is there a way around this problem?

    Re: Add Text To UserForm TextBox


    Yes -


    I see that I had made a change to the name of the Userform but I did not mentally connect this to the need to use the same name in the code. I was still using the original name.


    Of course, now that I see this, it is compellingly obvious!


    Thanks a lot!

    I have a game I have been developing using commandbuttons and comboboxes only, so I have protected the worksheet from selecting locked and unlocked cells.


    However, an undesirable side effect is that if a user accidentally doubleclicks on a cell in the worksheet, an error message pops up:


    The cell or chart you are trying to change is protected therefore read only.


    I have looked at numerous entries on the forum and noted that I can invoke a before doubleclick event handler and there is code to turn off display alerts -


    Code
    1. Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
    2. Application.DisplayAlerts = False
    3. End Sub


    This does not work as after the event handler is run (I used a MsgBox to prove it went to this event handler) the error message appears as before.


    Is there some code I can use that will trap the error and prevent a pop-up message from appearing?


    Ideally the user should be able to click anywhere on the screen or doubleclick with no apparent effect. Single clicking and mouse browsing already is handled properly by the application. It is the doubleclick I need to control.


    Any help is much appreciated!

    I want to add variable content to a textbox in a userform.


    I want to duplicate a Msgbox as closely as possible to allow me to position the box properly, and I would like a procedure to add a prompt to the userform as you would to a Msgbox.
    That is, I have found a solution using a cell in my spreadsheet, but I would like a fully vba oriented solution.


    In the message box you can say

    Code
    1. MsgBox Prompt:="Put your message here."


    For a textbox in a userform, I can link it to a cell (say A1) and then put data into the cell


    Code
    1. Range("A1").Value = "Put your message here."


    and it shows up in the text box when I do a


    Code
    1. Userform1.Show


    However, I don't want to use a cell in the worksheet as the application is totally command button, and userform oriented. I have tried to use


    Code
    1. Userform1.textbox.value = "Put your message here."


    and variations thereof but they do not work and the error messages from VB are not easy to comprehend.


    Any suggestions?


    As far as titles go, I can see where it would be advantageous to amend the title of a field or other object in the userform in response to certain conditions. I have not noticed any way to avoid hardcoding titles.