Checkbox Problem, Please Help!

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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
 
Back
Top