Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 08-24-2015, 06:46 AM
NoSparks NoSparks is offline Help with Macro Please Windows 7 64bit Help with Macro Please Office 2010 64bit
Excel Hobbyist
 
Join Date: Nov 2013
Location: British Columbia, Canada
Posts: 842
NoSparks is a glorious beacon of lightNoSparks is a glorious beacon of lightNoSparks is a glorious beacon of lightNoSparks is a glorious beacon of lightNoSparks is a glorious beacon of light
Default


If you have a lot of check boxes to put on your sheet, maybe you can make use of this macro I came across in the forums long time ago.
Play around with it in a blank workbook, it can be handy.
Code:
 Private Sub Insert_Checkboxes()
     Dim myCell As Range
     Dim myRng As Range
     Dim CBX As CheckBox

     With ActiveSheet
         'delete existing checkboxes from sheet, links are not cleared.
         .CheckBoxes.Delete
         'Exit Sub   '<~~~~~ uncomment to delete checkboxes only. Linked cells are NOT cleared.
         Set myRng = .Range("A2:A11")    '<~~~~~ enter the range to have checkboxes
     End With

Application.ScreenUpdating = False
     For Each myCell In myRng.Cells
         With myCell
             Set CBX = .Parent.CheckBoxes.Add _
                         (Top:=.Top, _
                          Left:=.Left, _
                          Width:=.Width, _
                          Height:=.Height)    'click area same size as cell
             CBX.Name = "CBX_" & .Address(0, 0)
             CBX.Caption = "Label goes here"     'or whatever you want
             CBX.Value = xlOff    'initial value unchecked
             CBX.LinkedCell = .Offset(0, 1).Address     '<~~~~~ enter offset to linked cell
         End With
     Next myCell
Application.ScreenUpdating = True
End Sub
Reply With Quote
Reply

Tags
cell, checkbox, macro



Similar Threads
Thread Thread Starter Forum Replies Last Post
Macro to add title in header is missing text once macro is run shawnee24 Word VBA 3 05-27-2015 12:35 PM
Help with Macro Please Macro Question: Need help making a macro to highlight the first word in every sentence LadyAna Word 1 12-06-2014 10:39 PM
Macro Needed to bold specific lines and Macro to turn into CSV anewteacher Word VBA 1 05-28-2014 03:59 PM
custom icon, undo/redo for macro, permanent macro Rapier Excel 0 08-05-2013 06:30 AM
How do I assign a macro to a button when the macro is in my personal workbook? foolios Excel Programming 2 07-27-2011 02:41 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 12:32 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft