![]() |
Selecting many Checkboxes to align & size
Hi Now my programs for my check boxes are working nicely thanks to Tom. I looks a little messy. How can I align and size all of my check boxes t be exactly the same. I thought it would be obvious, to be fair it still could be! :rolleyes -- Sa ----------------------------------------------------------------------- Saz's Profile: http://www.excelforum.com/member.php...fo&userid=1722 View this thread: http://www.excelforum.com/showthread.php?threadid=54952 |
Selecting many Checkboxes to align & size
I'm assuming you used checkboxes from the Controls toolbar. Set
the left, height and width properties of the first check box to the values you desire, then run the following code: Sub AAA() Dim FirstCheckbox As msforms.CheckBox Dim Chk As OLEObject For Each Chk In ActiveSheet.OLEObjects If TypeOf Chk.Object Is msforms.CheckBox Then If FirstCheckbox Is Nothing Then Set FirstCheckbox = Chk.Object Else Chk.Left = FirstCheckbox.Left Chk.Height = FirstCheckbox.Height Chk.Width = FirstCheckbox.Width End If End If Next Chk End Sub -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "Saz" wrote in message ... Hi Now my programs for my check boxes are working nicely thanks to Tom. It looks a little messy. How can I align and size all of my check boxes to be exactly the same. I thought it would be obvious, to be fair it still could be! :rolleyes: -- Saz ------------------------------------------------------------------------ Saz's Profile: http://www.excelforum.com/member.php...o&userid=17226 View this thread: http://www.excelforum.com/showthread...hreadid=549528 |
Selecting many Checkboxes to align & size
A better solution is as follows:
Sub AAA() Dim ReferenceCheckbox As msforms.CheckBox Dim Chk As OLEObject Set ReferenceCheckbox = ActiveSheet.OLEObjects("checkbox1").Object For Each Chk In ActiveSheet.OLEObjects If TypeOf Chk.Object Is msforms.CheckBox Then Chk.Left = ReferenceCheckbox.Left Chk.Height = ReferenceCheckbox.Height Chk.Width = ReferenceCheckbox.Width End If Next Chk End Sub Change "checkbox1" to the checkbox whose properties you want to use for left, height, and width. -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "Chip Pearson" wrote in message ... I'm assuming you used checkboxes from the Controls toolbar. Set the left, height and width properties of the first check box to the values you desire, then run the following code: Sub AAA() Dim FirstCheckbox As msforms.CheckBox Dim Chk As OLEObject For Each Chk In ActiveSheet.OLEObjects If TypeOf Chk.Object Is msforms.CheckBox Then If FirstCheckbox Is Nothing Then Set FirstCheckbox = Chk.Object Else Chk.Left = FirstCheckbox.Left Chk.Height = FirstCheckbox.Height Chk.Width = FirstCheckbox.Width End If End If Next Chk End Sub -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "Saz" wrote in message ... Hi Now my programs for my check boxes are working nicely thanks to Tom. It looks a little messy. How can I align and size all of my check boxes to be exactly the same. I thought it would be obvious, to be fair it still could be! :rolleyes: -- Saz ------------------------------------------------------------------------ Saz's Profile: http://www.excelforum.com/member.php...o&userid=17226 View this thread: http://www.excelforum.com/showthread...hreadid=549528 |
Selecting many Checkboxes to align & size
That has sorted it thanks Chip -- Sa ----------------------------------------------------------------------- Saz's Profile: http://www.excelforum.com/member.php...fo&userid=1722 View this thread: http://www.excelforum.com/showthread.php?threadid=54952 |
All times are GMT +1. The time now is 11:16 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com