Home |
Search |
Today's Posts |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
As it appears you have moved checkboxes all over the place it's not
straightforward to loop through renameing them according to their grid positions. Far easier, I think, to start afresh. Try the following on a new sheet and adapt to your needs. Apart from locations you will probably want to work out where you want your linked cells. Adds checkboxes from the "Forms" menu: Sub CBgrid() Dim d As Long, i As Long Dim rw As Long, cl As Long, dr As Long Dim lt As Single, tp As Single Dim ch As CheckBox Dim ws As Worksheet Set ws = ActiveSheet 'ws.CheckBoxes.Delete For d = 10 To 200 Step 10 dr = dr + 2 tp = Rows(dr).Top For i = 0 To 8 lt = Columns(i * 2 + 3).Left rw = rw + 1 Set cel = Cells(rw, 1) With ws.CheckBoxes.Add(lt, tp, 76.5, 20) .Name = "CheckBox " & (d + i) .Caption = .Name .Placement = xlMove cel.Value = .Name .LinkedCell = cel.Offset(0, 1).Address End With Next Next Columns("A:A").EntireColumn.AutoFit End Sub If you are going to use this, I suggest first delete all your existing checkboxes and anyother shapes on the sheet, save & reopen to reset the new object counter. Regards, Peter T "grime" wrote in message ... I have a sheet that contains 180 checkboxes ![]() The names of those checkboxes are all over the place, and I want the names for the first row of boxes to be CheckBox 10, CheckBox 11... CheckBox 18. Next Row is CheckBox 20, CheckBox 21... And so on... I can change the name by using the name box, but with so many, it would be much easier to use a macro. I think using a loop, with a SendKeys("{TAB"}) will work, but I can't seem to find the code that will change the name. ![]() Someone help! Thanks in advance. -- grime ------------------------------------------------------------------------ grime's Profile: http://www.excelforum.com/member.php...o&userid=19227 View this thread: http://www.excelforum.com/showthread...hreadid=479510 |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
problem with checkbox control | Excel Worksheet Functions | |||
how do I protect a worksheet and still use a checkbox control | Excel Worksheet Functions | |||
Checkbox control | Excel Programming | |||
enlarge built-in checkbox control | Excel Programming | |||
VBA Control Checkbox | Excel Programming |