ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   store chkbox.caption in array (https://www.excelbanter.com/excel-programming/331128-store-chkbox-caption-array.html)

ilyaskazi[_19_]

store chkbox.caption in array
 

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"

--
ilyaskaz
-----------------------------------------------------------------------
ilyaskazi's Profile: http://www.excelforum.com/member.php...fo&userid=2396
View this thread: http://www.excelforum.com/showthread.php?threadid=37703


Tom Ogilvy

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




ilyaskazi[_20_]

store chkbox.caption in array
 

working perfect...

but is it possible if our checkboxes names (not caption) are customize
as per our requirement

--
ilyaskaz
-----------------------------------------------------------------------
ilyaskazi's Profile: http://www.excelforum.com/member.php...fo&userid=2396
View this thread: http://www.excelforum.com/showthread.php?threadid=37703


Tom Ogilvy

store chkbox.caption in array
 
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) = "chkbox" & i
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 ...

working perfect...

but is it possible if our checkboxes names (not caption) are customized
as per our requirement.


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

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





All times are GMT +1. The time now is 02:14 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com