Forum Discussion
Format ALL checkboxes to link to adjacent cells w/o having to Format Control all individually?
- Jan 16, 2020
My example sized the checkboxes at 30 pixels high, starting at (0,0) i.e. top left of the sheet, and with a row height of 30 as well. Play around a little with the parameters to make it match your requirements.
Thank you Riny_van_Eekelen! I think this will work. It will be faster to just do this and manually recheck them than having to individually format. Just one question. It looks like the checkboxes skip a line, but the linked cells do not, so they separate. Is there anyway I can adjust the cells to keep them next to each other? (See image below.) Thanks again for your help.
My example sized the checkboxes at 30 pixels high, starting at (0,0) i.e. top left of the sheet, and with a row height of 30 as well. Play around a little with the parameters to make it match your requirements.
- Donald_BarrNov 30, 2023Copper Contributor
Hi there , this macro is nearly ideal for what I'm trying to do but I need vary the starting location as I am creating a whole table of checkboxes, each with a linked cell (on a separate worksheet). The bit I have not worked out is how to change the starting location for each column of checkboxes.
As it is the column starts in A1 but I want to start in D4 (and then repeat in E4, F4 etc)
- Riny_van_EekelenNov 30, 2023Platinum Contributor
OK, this is a rather old post and the macro I referred to isn't really working as I remembered it used to at the time. The pixel count seems to be way off on my current system. Can't really tell why.
But, the placement of the checkboxes is based on the first two parameters in the Checkboxes.Add (x, y, w, h) function. That is x-position, y-position, width and height).
If you now want to place the boxes horizontally starting in Column D, run some tests with three or four boxes (not 5000!!) and find the right coordinates and size setting. You also need to make the x-coordinate variable and not the y-coordinate. Finally, you must find a way to set the linked cells to the column number in stead of the row number.
Probably not all that difficult but I no longer touch VBA. Am simply not good enough at it and find it to much hassle to achieve very little. My personal opinion and no offense to those who love it and can do magic with VBA. But that's not me.
- Donald_BarrNov 30, 2023Copper Contributor
That makes perfect sense. I used to use Excel at lot and had occasion to use VBA macros to automate some tasks. I've never had any expertise but could usually work things by recording the necessary steps and tinkering with macros I found online. I'm now retired but I'm updating something I did a few years ago as a favour.
I found a clunky work-around which was to create the checkboxes in column A and just drag them to where I need them. Labourious and slow but it works.
Thanks very much for responding to my question!
Donald
- _hgr_excelhelpJan 16, 2020Copper ContributorThank you!