Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Checkbox Problem, Please Help!
Hello,
A former coworker wrote a macro that creates checkboxes in each cell in column B, starting in cell B17, based on the values of the corresponding cells in column C. The captions for the checkboxes are equal to the values of cells in column C. The macro stops when it reaches the first empty value in column C. The code is pasted below. The problem is that when I run the macro, it enters the checkboxes in column A instead of column B. I cant figure out why this is happening. Any help with this would be greatly appreciated. Thank you! Magnivy Sub Create_Status_Checkboxes() Dim x Dim objRange As Excel.Range Set objRange = Sheet7.Range("B17") For Each x In objRange.Worksheet.Shapes If InStr(1, x.Name, "Check Box") 0 Then x.Delete Next Do Until IsEmpty(objRange.Offset(0, 1)) Set x = objRange.Worksheet.CheckBoxes.Add(0, objRange.Top, objRange.Width, objRange.Height) objRange.Font.ColorIndex = IIf(objRange.Interior.ColorIndex < 0, 2, objRange.Interior.ColorIndex) objRange.value = False With x .Text = objRange.Offset(, 1).value .Placement = xlMove .PrintObject = False .value = xlOff .LinkedCell = objRange.AddressLocal End With Set objRange = objRange.Offset(1) Loop End Sub |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Checkbox Problem, Please Help!
I figured out the problem.
Thanks for reading my question! Magnivy "Magnivy" wrote: Hello, A former coworker wrote a macro that creates checkboxes in each cell in column B, starting in cell B17, based on the values of the corresponding cells in column C. The captions for the checkboxes are equal to the values of cells in column C. The macro stops when it reaches the first empty value in column C. The code is pasted below. The problem is that when I run the macro, it enters the checkboxes in column A instead of column B. I cant figure out why this is happening. Any help with this would be greatly appreciated. Thank you! Magnivy Sub Create_Status_Checkboxes() Dim x Dim objRange As Excel.Range Set objRange = Sheet7.Range("B17") For Each x In objRange.Worksheet.Shapes If InStr(1, x.Name, "Check Box") 0 Then x.Delete Next Do Until IsEmpty(objRange.Offset(0, 1)) Set x = objRange.Worksheet.CheckBoxes.Add(0, objRange.Top, objRange.Width, objRange.Height) objRange.Font.ColorIndex = IIf(objRange.Interior.ColorIndex < 0, 2, objRange.Interior.ColorIndex) objRange.value = False With x .Text = objRange.Offset(, 1).value .Placement = xlMove .PrintObject = False .value = xlOff .LinkedCell = objRange.AddressLocal End With Set objRange = objRange.Offset(1) Loop End Sub |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Checkbox problem | Excel Programming | |||
problem with checkbox control | Excel Worksheet Functions | |||
Checkbox problem | Excel Programming | |||
Checkbox problem | Excel Programming | |||
Help: weild checkbox problem | Excel Programming |