LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default Changing CheckBox Control Names

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 in a 20 x 9 grid.

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
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
problem with checkbox control Giselle Excel Worksheet Functions 1 March 31st 06 12:57 PM
how do I protect a worksheet and still use a checkbox control JayS Excel Worksheet Functions 4 September 8th 05 07:36 AM
Checkbox control packat[_2_] Excel Programming 6 January 1st 05 02:27 PM
enlarge built-in checkbox control Lore Leuneog Excel Programming 0 October 24th 04 10:34 PM
VBA Control Checkbox Tommy[_6_] Excel Programming 2 August 7th 03 06:02 PM


All times are GMT +1. The time now is 06:14 AM.

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

About Us

"It's about Microsoft Excel"