Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
centering checkboxes
Hi
I have a worksheet where I add checkboxes on each row so I can decide wether to include that row in my calculations. I've found some code that does the job of adding the checkboxes very nicely, for some reason the checkboxes that are added are all aligned to the top of the sheet and when getting to lower rows they are not add to the right location. I was hoping someone could take a look at this and tell me if there's something I could do to make the checkboxes align themeselves to each cell they are added to. code: Sub AddCheckBoxes() On Error Resume Next Dim c As Range, myRange As Range Set myRange = Selection For Each c In myRange.Cells ActiveSheet.CheckBoxes.Add(c.Left, c.Top, c.Width, c.Height).Select With Selection .LinkedCell = c.Address .Characters.Text = "123" .Name = c.Address End With c.Select With Selection .FormatConditions.Delete .FormatConditions.Add Type:=xlExpression, _ Formula1:="=" & c.Address & "=TRUE" .FormatConditions(1).Font.ColorIndex = 6 'change for other color when ticked .FormatConditions(1).Interior.ColorIndex = 6 'change for other color when ticked .Font.ColorIndex = 2 'cell background color = White End With Next myRange.Select End Sub |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Consider space in centering | Excel Discussion (Misc queries) | |||
Centering | New Users to Excel | |||
Centering comments | Excel Worksheet Functions | |||
Centering columns | Excel Discussion (Misc queries) | |||
Centering Toolbars | Excel Programming |