Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default CheckBox values

I have created a user dialog form with three tabs. Each of
the tabs list on of 20 different companies for which a
user can print a financial statement (P&L, Bal Sht, CF).
Therefore, by design, I have 60 different checkboxes. Each
check box is named in accordance with the company name and
the statement type (IE: plComp1cb, bsComp1cb...).

To print the selection of reports, I am using arrays for
each of the variables. Rather than list each of the 60
checkboxes I though I might be able to concatenate the
name, then attain the value for that check box. therefore,
I have two arrays that would merge to create a checkbox
name:

Array1(pl, bs, cf)
Array2(Comp1, Comp2, Comp3...)

In short, if I were to use loops and if statements to
check the value (true / false), I should be able to attain
the value of each check box, ascertain the value and print
(or skip printing). I have not been able to determine the
correct syntax to check the checkbox. I have done similar
techniques using worksheets - sheet(array1 & array2).value
but have been unsuccessful in using the same technique for
checkboxers - checkbox(array1 & array2).value

Any suggestions?

Allan
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,824
Default CheckBox values

Maybe just split the checkbox name (I put the code under a button on the
userform):

Option Explicit
Private Sub CommandButton1_Click()

Dim ctrl As MSForms.Control
Dim rptName As String
Dim pfxType As String

For Each ctrl In UserForm1.Controls
If TypeOf ctrl Is MSForms.CheckBox Then
If ctrl.Object.Value = True Then
pfxType = LCase(Left(ctrl.Name, 2))
rptName = Mid(ctrl.Name, 3, Len(ctrl.Name) - 4)
Select Case pfxType
Case Is = "pl": Call doPL(rptName)
Case Is = "bs": Call doBS(rptName)
Case Is = "cf": Call doCF(rptName)
Case Else: MsgBox "design error!"
End Select

End If
End If
Next ctrl
End Sub


Then in your general module, do the work:

Option Explicit
Sub doPL(myRpt As String)
MsgBox myRpt
End Sub
Sub doBS(myRpt As String)
MsgBox myRpt
End Sub
Sub doCF(myRpt As String)
MsgBox myRpt
End Sub


Allan wrote:

I have created a user dialog form with three tabs. Each of
the tabs list on of 20 different companies for which a
user can print a financial statement (P&L, Bal Sht, CF).
Therefore, by design, I have 60 different checkboxes. Each
check box is named in accordance with the company name and
the statement type (IE: plComp1cb, bsComp1cb...).

To print the selection of reports, I am using arrays for
each of the variables. Rather than list each of the 60
checkboxes I though I might be able to concatenate the
name, then attain the value for that check box. therefore,
I have two arrays that would merge to create a checkbox
name:

Array1(pl, bs, cf)
Array2(Comp1, Comp2, Comp3...)

In short, if I were to use loops and if statements to
check the value (true / false), I should be able to attain
the value of each check box, ascertain the value and print
(or skip printing). I have not been able to determine the
correct syntax to check the checkbox. I have done similar
techniques using worksheets - sheet(array1 & array2).value
but have been unsuccessful in using the same technique for
checkboxers - checkbox(array1 & array2).value

Any suggestions?

Allan


--

Dave Peterson

Reply
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
How to have Checkbox A uncheck with checked Checkbox B Texas Aggie Excel Discussion (Misc queries) 3 July 20th 07 10:58 PM
Checkbox values? T135 Excel Worksheet Functions 2 January 12th 07 10:46 AM
Checkbox values from a web client Larry[_10_] Excel Programming 1 September 11th 03 06:45 PM
checkbox Paul P Excel Programming 0 September 10th 03 08:56 PM
"Store" ufm.checkbox values for later use zsplash Excel Programming 4 July 24th 03 08:11 AM


All times are GMT +1. The time now is 01:12 AM.

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

About Us

"It's about Microsoft Excel"