Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 389
Default 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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,588
Default 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



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default 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
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 389
Default 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
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default 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


  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 389
Default 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

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
Runtime Error 91 Object variable or With block variable not set. Tim Excel Programming 9 June 5th 08 10:03 PM
Object Variable Not Set Error on Selection object Jean Excel Worksheet Functions 3 July 24th 06 06:45 PM
Run-time Error'91: Object variable or With block variable not set DynamiteSkippy Excel Programming 4 September 26th 05 07:47 AM
Run-time error '91': "Object variable or With block variable not set Mike[_92_] Excel Programming 2 December 30th 04 10:59 AM
Cells.Find error Object variable or With block variable not set Peter[_21_] Excel Programming 2 May 8th 04 02:15 PM


All times are GMT +1. The time now is 05:49 PM.

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

About Us

"It's about Microsoft Excel"