View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default Checkbox control

Whoops, - left off the Object qualifier

Private Sub btnResetConst_Click()
Dim i As Integer
For i = 1 To 14
Sheet11.OleObjects("chkParams" & i).Object.Value = False
next i
End Sub

--
Regards,
Tom Ogilvy

"Tom Ogilvy" wrote in message
...
Private Sub btnResetConst_Click()
Dim i As Integer
For i = 1 To 14
Sheet11.OleObjects("chkParams" & i).Value = False
next i
End Sub

--
Regards,
Tom Ogilvy


"packat" wrote in message
news:wklBd.8300$1U6.2321@trnddc09...


I have 10 checkboxes with names chkParams1,
chkParams2,...,chkParams10.

I am writing a sub to reset these boxes using a control box.
I could simply put the statement:
Sheet11.chkParams1.Value = False .....

for all of the boxes. But I am wondering if there is a
better way using a for loop.
How do I make the checkbox name dynamic so that I can do the
following:

Private Sub btnResetConst_Click()
Dim i As Integer
For i = 1 To 14
Sheet11.chkParams???.Value = False
next i
End Sub



Thanks,
pac