Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 70
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 70
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Checkbox problem WLMPilot Excel Programming 1 July 23rd 06 02:47 PM
problem with checkbox control Giselle Excel Worksheet Functions 1 March 31st 06 12:57 PM
Checkbox problem Patrick Simonds Excel Programming 1 September 29th 05 08:47 AM
Checkbox problem Patrick Simonds Excel Programming 1 September 29th 05 05:37 AM
Help: weild checkbox problem huangx06 Excel Programming 0 July 7th 05 11:13 PM


All times are GMT +1. The time now is 06:58 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"