ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   User variable to get object value (https://www.excelbanter.com/excel-programming/422429-user-variable-get-object-value.html)

steven

User variable to get object value
 
Can you use a variable to return the vaule of an object in a form.

Example:

vCheckbox = "Me.Checkbox.12"

MsgBox vCheckbox

it gives me Me.CheckBox.12 when what I am looking for is True or False

Thank you,

Steven

Dave Peterson

User variable to get object value
 
I think you want:

Dim vCheckbox as boolean
vCheckbox = me.checkbox12.value



Steven wrote:

Can you use a variable to return the vaule of an object in a form.

Example:

vCheckbox = "Me.Checkbox.12"

MsgBox vCheckbox

it gives me Me.CheckBox.12 when what I am looking for is True or False

Thank you,

Steven


--

Dave Peterson

Tim Williams

User variable to get object value
 
Dim vCheckbox
Set vCheckbox = Me.Checkbox.12
MsgBox vCheckbox.Checked

Tim




"Steven" wrote in message
...
Can you use a variable to return the vaule of an object in a form.

Example:

vCheckbox = "Me.Checkbox.12"

MsgBox vCheckbox

it gives me Me.CheckBox.12 when what I am looking for is True or False

Thank you,

Steven




steven

User variable to get object value
 
Thank you for the response:

What I have is 15 checkboxes... CheckBox11 to CheckBox 25

Based on certain criteria will determine which checkbox I want the value of:

I would like to do it using the number 11 to 25 as a variable and then
creating a string for like

vCkBox = "Me.CheckBox " + vNumber
MsgBox vCkBox.Value

or something like that.

Thank you, Steven

Dave Peterson

User variable to get object value
 
dim iCtr as long
for ictr = 11 to 25
msgbox me.controls("Checkbox" & ictr).value
next ictr



Steven wrote:

Thank you for the response:

What I have is 15 checkboxes... CheckBox11 to CheckBox 25

Based on certain criteria will determine which checkbox I want the value of:

I would like to do it using the number 11 to 25 as a variable and then
creating a string for like

vCkBox = "Me.CheckBox " + vNumber
MsgBox vCkBox.Value

or something like that.

Thank you, Steven


--

Dave Peterson

steven

User variable to get object value
 
Dave,

That is nice.

Thank you,

Steven

"Dave Peterson" wrote:

dim iCtr as long
for ictr = 11 to 25
msgbox me.controls("Checkbox" & ictr).value
next ictr



Steven wrote:

Thank you for the response:

What I have is 15 checkboxes... CheckBox11 to CheckBox 25

Based on certain criteria will determine which checkbox I want the value of:

I would like to do it using the number 11 to 25 as a variable and then
creating a string for like

vCkBox = "Me.CheckBox " + vNumber
MsgBox vCkBox.Value

or something like that.

Thank you, Steven


--

Dave Peterson



All times are GMT +1. The time now is 01:34 PM.

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