Checkbox Problem, Please Help!

M

Magnivy

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top