View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default store chkbox.caption in array

Assume the checkboxes are from the control toolbox toolbar and are located
on a userform:

Dim myArray(), i as long, j as Long
Redim MyArray(1 to 5)
j = 0
for i = 1 to 5
if userform1.controls("chkbox" & i).Value = True then
j = j + 1
myarray(j) = userform1.Controls("chkbox" & i).caption
end if
Next
if j 0 then
Redim Preserve MyArray(1 to j)
else
erase myArray
End if

--
Regards,
Tom Ogilvy

"ilyaskazi" wrote
in message ...

store chkbox.caption of selected checkboxes only in array.

suppose..
chkbox1.caption is = FARES
chkbox2.caption is = RULES
chkbox3.caption is = ZONES
chkbox4.caption is = CONDITIONS
chkbox5.caption is = ROUTING

now below are chkbox selected from above..
chkbox1
chkbox3
chkbox4

get the name of selected chkboxes and store as...
MyArray = Array("FARES", "ZONES", "CONDITIONS")


--
ilyaskazi
------------------------------------------------------------------------
ilyaskazi's Profile:

http://www.excelforum.com/member.php...o&userid=23969
View this thread: http://www.excelforum.com/showthread...hreadid=377033