+ Reply to Thread
Results 1 to 10 of 10

Changing checkbox size in Userform or alternative solution?

  1. #1
    Forum Contributor
    Join Date
    05-28-2020
    Location
    Poland
    MS-Off Ver
    O365,
    Posts
    120

    Thumbs up Changing checkbox size in Userform or alternative solution?

    Hello everyone,

    I am new to VBA and trying my best to help a colleague to build a registration form using UserForm.

    During the setup, I realised, that I am not able to change the size of the checkbox, inserted through tools. Checking on the internet, I do not really find anything helpful, to change the size of the checkbox itself.

    The form is generous with a big fontsize and therefore, I wanted to increase the size of the checkbox but have not found anything and am not able to change it and it looks redicolous on the form.

    It looks, like there is no real solution for that (or at least I was not able to find anything) and therefore I am asking, is there a way, that a command button could be manipulated on such way, that when you press it, it woudl have the same behaviour like a checkbox?
    So if you press the button, there suddenly would be an X on it and if you press it again, the X will disappear and with the effect, can be written into a cell in excel?

    Not sure, if it is possible and if yes, how complicated that would be?

    Thank you very much,

    Mike

  2. #2
    Forum Expert
    Join Date
    08-17-2007
    Location
    Poland
    Posts
    2,161

    Re: Changing checkbox size in Userform or alternative solution?

    ToggleButon?

    Artik

  3. #3
    Forum Contributor
    Join Date
    05-28-2020
    Location
    Poland
    MS-Off Ver
    O365,
    Posts
    120

    Re: Changing checkbox size in Userform or alternative solution?

    Dear Artik,

    thank you for your reply.

    I did some experiencing and I might have found a workaround for my requirement. I haven't used the ToggleButon yet but I did use the command button instead.

    I wrote the following code (please forgive me, if I did mistakes!!! I am new to VBA) and it looks like the following:

    Please Login or Register  to view this content.
    I created two buttons 1 & 2 and put a caption "X" into it and enlarged it to be aligned with the size of the button itself and I use boolean to switch between black and white,
    so to hide or show the X.

    As I need to write the value into a cell and then get it back again, I used also the range command and tried it on a second button and it behaves as expected.

    Maybe not the most sophistcated way to solve a problem but at least a workaround

    thank you very much,

    Mike

  4. #4
    Forum Expert
    Join Date
    08-17-2007
    Location
    Poland
    Posts
    2,161

    Re: Changing checkbox size in Userform or alternative solution?

    In the attachment you have several ways to use pseudo-checkboxes. Two images were used for each. With all button solutions (ToggleButton and CommandButton), you can hide the Image controls permanently (in Sub Initialize, for both set Visible=False). Under OK, you will see how to refer to the controls in each solution to get a Boolean value, just like for a standard CheckBox.

    Please Login or Register  to view this content.
    Cell A2 contains a logical value. So the condition should check if it contains a logical value, not a text value. Even if it works, never do it.
    Please Login or Register  to view this content.

    Artik
    Attached Files Attached Files

  5. #5
    Forum Contributor
    Join Date
    05-28-2020
    Location
    Poland
    MS-Off Ver
    O365,
    Posts
    120

    Re: Changing checkbox size in Userform or alternative solution?

    Dear Artik,

    Thank you very much for your help, support and feedback. Regarding the cell containing the logical value, do I understand correctly, that I have to leave out the quotation marks?

    From your example, I definitely like the image version

    Thanx again

  6. #6
    Forum Expert
    Join Date
    08-17-2007
    Location
    Poland
    Posts
    2,161

    Re: Changing checkbox size in Userform or alternative solution?

    Quote Originally Posted by mstgier View Post
    do I understand correctly, that I have to leave out the quotation marks?
    Yes

    Quote Originally Posted by mstgier View Post
    I definitely like the image version
    But there is a minor inconvenience in this solution. Image controls cannot take focus, so they never become active, as is the case with other controls.


    Artik

  7. #7
    Forum Contributor
    Join Date
    05-28-2020
    Location
    Poland
    MS-Off Ver
    O365,
    Posts
    120

    Re: Changing checkbox size in Userform or alternative solution?

    I need to run tests and figure out if it works. So far it looks good, because I can write into excel the value and take it back into the form. I do not need any further actions, because it is only a registration form.

    If it doesn't work, I will play around with the other solutions you have prepared.

    Thanx a million,

    Mike

  8. #8
    Valued Forum Contributor
    Join Date
    05-03-2022
    Location
    Halifax,Canada
    MS-Off Ver
    365
    Posts
    326

    Re: Changing checkbox size in Userform or alternative solution?

    HOw about this ?

    ScrShot28.gif

    HOW TO DO IT :
    1) add checkbox3 to userform
    2) create lablel3
    3) set label3 background to white
    4) set label3 font to wingdings and set font size
    5) size and position label3 over checkbox3's checkbox
    6) Insert the following code into the userform

    Results:
    Works exactly like the usual checkbox eg. tab works the same, click works the same , space bar , etc
    The checkmark in label is in sync with checkmark of checkbox3, so use the checkboxs value as your form output

    Only code required to achieve usual checkbox behaviour.
    Please Login or Register  to view this content.
    if this has helped please consider clicking "add reputation" , thx

    SAMPLE WORKBOOK WITH FORM >>> checkbox.xlsm
    Last edited by nimrod1313; 08-25-2022 at 09:00 AM.

  9. #9
    Forum Contributor
    Join Date
    05-28-2020
    Location
    Poland
    MS-Off Ver
    O365,
    Posts
    120

    Re: Changing checkbox size in Userform or alternative solution?

    Hello nimrod,

    Your solution worked also and I see, there are many workarounds for my challenge. Interesting, that there is not too much on the internet about it.

    I have to play around a little bit to get a better understanding but your solution works as the ones from Artik and I am thankful for that.

    Greetings to Halifax (have been there several years ago and took the opportunity to go to the crash side to give my respect), loved Canada

    Have a great weekend and thanx again,

    Mike

  10. #10
    Valued Forum Contributor
    Join Date
    05-03-2022
    Location
    Halifax,Canada
    MS-Off Ver
    365
    Posts
    326

    Re: Changing checkbox size in Userform or alternative solution?

    Hello Mstgier
    Thx for looking at my solution. Glad you have alot of options and solutions to pick from.
    Thx for appreciating Halifax , we just moved here in November from 35 years in Vancouver... so we're still getting our "sea legs".

    Cheers
    Nimrod1313

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Image saved from inkpicture userform changing size
    By Jissenka in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-11-2017, 07:07 PM
  2. Userform Checkbox Caption Font Size
    By didless in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 04-05-2017, 06:09 PM
  3. VBA Userform Re-size or Scroll Bar solution
    By gtudor in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 10-05-2016, 08:14 AM
  4. UserForm changing size from one computer to another
    By JJFletcher in forum Excel Formulas & Functions
    Replies: 16
    Last Post: 10-11-2015, 06:15 PM
  5. Changing the size of a userform
    By j_Southern in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-29-2014, 08:25 AM
  6. [SOLVED] Change font size of UserForm checkbox
    By PDBartlett in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-20-2014, 10:35 AM
  7. Calendar in UserForm changing size
    By kvo in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-02-2007, 07:07 PM

Tags for this Thread

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