+ Reply to Thread
Results 1 to 3 of 3

Macro stuffing up my checkboxes

  1. #1
    Registered User
    Join Date
    05-09-2018
    Location
    Australia
    MS-Off Ver
    Office 365
    Posts
    32

    Macro stuffing up my checkboxes

    Hi all,

    Have a list of items with 3 form checkboxes on each line.
    When I click on the worksheet to and copy to new workbook etc it all looks good in the new workbook. Perfect.
    If I record a macro to do this process and then run the macro it will deselect all that were selected and display the work "Check" next to each of them and some of them will double up.

    This will happen to the original content and also the new content pasted into the new workbook.

    Any ideas as to why?

    Edit - I do notice all the original data is there, but brand new checkboxes are added to each cell covering the original data. (In both the original workbook and the copy into the new workbook)

    Please Login or Register  to view this content.

  2. #2
    Forum Expert Greg M's Avatar
    Join Date
    08-16-2007
    Location
    Dublin. Ireland
    MS-Off Ver
    Office 2016
    Posts
    4,645

    Re: Macro stuffing up my checkboxes

    Hi there,

    If you run that code while the active worksheet contains CheckBoxes created by a previous execution of the code, another set of CheckBoxes will be created on top of the original set.

    If I have understood your requirements correctly (and I may well not have!) you need two separate routines - one to create the CheckBoxes on the initial worksheet, and one to copy that worksheet to a new workbook.

    The word "Check" which you are seeing is the shortened version of "Check Box nnn" which Excel assigns as the default caption of a newly-added Checkbox - you are seeing the shortened version of this caption because the width (124) you assigned to the Checkbox isn't large enough to display the entire caption.

    Just for information, a more flexible way to create your CheckBoxes is outlined below - using an approach like this means that it is far less painful if you ever need to change the positions and/or dimensions of the CheckBoxes.

    Please Login or Register  to view this content.

    The above code will create 24 of the CheckBoxes created by your original code - to add more rows of Checkboxes, just change the iNO_OF_ROWS value to suit, and add an extra vaTops(i) = nnn statement for each new row of CheckBoxes.


    Hope this helps - please let me know how you get on.

    Regards,

    Greg M

  3. #3
    Forum Expert
    Join Date
    10-06-2017
    Location
    drevni ruchadlo
    MS-Off Ver
    old
    Posts
    2,301

    Re: Macro stuffing up my checkboxes

    Quote Originally Posted by Greg M View Post
    ... The above code will create 24 of the CheckBoxes created by your original code ...
    Quote Originally Posted by koska View Post
    ...
    1. Have a list of items with 3 form checkboxes on each line ...
    2. ...macro ... deselect all that were selected ...
    3. ...and some of them will double up ...
    4. ... but brand new checkboxes are added to each cell covering the original data (In both the original workbook and the copy into the new workbook)
    koska,
    1. How many do you really have these x3 lines ?
    (for now you have 4 blocks of CheckBoxes for 7x3, 5x3, 10x3 and 14x3 items)
    2. Would you like the macro to select all of these check boxes ?
    3. Which ones are "duble up" ?
    4. ???

+ 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. Replies: 3
    Last Post: 09-05-2013, 03:49 AM
  2. Replies: 4
    Last Post: 04-28-2013, 12:47 AM
  3. Print Sheets based on checkboxes in UserForm, Checkboxes also control another macro
    By krackaberr in forum Excel Programming / VBA / Macros
    Replies: 34
    Last Post: 03-05-2013, 11:12 AM
  4. [SOLVED] #REF stuffing up my IF Statement
    By gwsampso in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 10-30-2012, 11:47 PM
  5. Stuffing Multiple Checkbox Captions
    By Sandy in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-06-2006, 04:10 AM
  6. Need More Help on Stuffing Checkbox control
    By Sandy in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-05-2006, 09:10 PM
  7. Stuffing Numeric Variable Values into Footnote with formatting
    By Dkline in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-15-2005, 05:05 PM
  8. Stuffing a picture into a header
    By DRK in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-16-2005, 02:05 PM

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