ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Strings (https://www.excelbanter.com/excel-programming/331791-strings.html)

Aran

Strings
 
Hello
I have a question about strings
How do i make the value runnable
ex.
str = "checkbox1"
and i like to use the string instead of the name checkbox1
and do this
checkbox1.value = 10

or if the string contain a name of a funktion how to run that with the string

i hope you understand my question
thanks

STEVE BELL

Strings
 
In Excel 2000 VBE want's str as Object
And needs the Set instruction

Dim str As Object

Set str = UserForm1.CheckBox1
str = 1
UserForm1.Show


I don't know how to make it work from a string
--
steveB

Remove "AYN" from email to respond
"Aran" wrote in message
...
Hello
I have a question about strings
How do i make the value runnable
ex.
str = "checkbox1"
and i like to use the string instead of the name checkbox1
and do this
checkbox1.value = 10

or if the string contain a name of a funktion how to run that with the
string

i hope you understand my question
thanks




Bob Phillips[_6_]

Strings
 
Me.Controls(str).Value = True


BTW you cannot set a checbox value to 10, just True or False.

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Aran" wrote in message
...
Hello
I have a question about strings
How do i make the value runnable
ex.
str = "checkbox1"
and i like to use the string instead of the name checkbox1
and do this
checkbox1.value = 10

or if the string contain a name of a funktion how to run that with the

string

i hope you understand my question
thanks




Aran

Strings
 
Sorry about my example

i have the checkboxes on a worksheet
and when i try your example it say it cant find the method "controls"

"Bob Phillips" wrote:

Me.Controls(str).Value = True


BTW you cannot set a checbox value to 10, just True or False.

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Aran" wrote in message
...
Hello
I have a question about strings
How do i make the value runnable
ex.
str = "checkbox1"
and i like to use the string instead of the name checkbox1
and do this
checkbox1.value = 10

or if the string contain a name of a funktion how to run that with the

string

i hope you understand my question
thanks





Bob Phillips[_6_]

Strings
 
No problems Aran, just making sure.

I Assumed userform checkbox.

If it is a control toolbox checkbox, use

ActiveSheet.OLEObjects(str).Object.Value = True

If it is a forms checkbox, use

ActiveSheet.CheckBoxes(str).Value = True


--

HTH

RP
(remove nothere from the email address if mailing direct)


"aran" wrote in message
...
Sorry about my example

i have the checkboxes on a worksheet
and when i try your example it say it cant find the method "controls"

"Bob Phillips" wrote:

Me.Controls(str).Value = True


BTW you cannot set a checbox value to 10, just True or False.

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Aran" wrote in message
...
Hello
I have a question about strings
How do i make the value runnable
ex.
str = "checkbox1"
and i like to use the string instead of the name checkbox1
and do this
checkbox1.value = 10

or if the string contain a name of a funktion how to run that with the

string

i hope you understand my question
thanks







Aran

Strings
 
Thanks
Thats worked fine with the value but if i try visible it say that
the method is not supported

And if i like to run a funktion the same way how do i do



"Bob Phillips" wrote:

No problems Aran, just making sure.

I Assumed userform checkbox.

If it is a control toolbox checkbox, use

ActiveSheet.OLEObjects(str).Object.Value = True

If it is a forms checkbox, use

ActiveSheet.CheckBoxes(str).Value = True


--

HTH

RP
(remove nothere from the email address if mailing direct)


"aran" wrote in message
...
Sorry about my example

i have the checkboxes on a worksheet
and when i try your example it say it cant find the method "controls"

"Bob Phillips" wrote:

Me.Controls(str).Value = True


BTW you cannot set a checbox value to 10, just True or False.

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Aran" wrote in message
...
Hello
I have a question about strings
How do i make the value runnable
ex.
str = "checkbox1"
and i like to use the string instead of the name checkbox1
and do this
checkbox1.value = 10

or if the string contain a name of a funktion how to run that with the
string

i hope you understand my question
thanks







Aran

Strings
 
Hello
I find out how to do
ActiveSheet.OLEObjects(str).Visible = True
worked fine

but i still have the question about how to run a funktion


"aran" wrote:

Thanks
Thats worked fine with the value but if i try visible it say that
the method is not supported

And if i like to run a funktion the same way how do i do



"Bob Phillips" wrote:

No problems Aran, just making sure.

I Assumed userform checkbox.

If it is a control toolbox checkbox, use

ActiveSheet.OLEObjects(str).Object.Value = True

If it is a forms checkbox, use

ActiveSheet.CheckBoxes(str).Value = True


--

HTH

RP
(remove nothere from the email address if mailing direct)


"aran" wrote in message
...
Sorry about my example

i have the checkboxes on a worksheet
and when i try your example it say it cant find the method "controls"

"Bob Phillips" wrote:

Me.Controls(str).Value = True


BTW you cannot set a checbox value to 10, just True or False.

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Aran" wrote in message
...
Hello
I have a question about strings
How do i make the value runnable
ex.
str = "checkbox1"
and i like to use the string instead of the name checkbox1
and do this
checkbox1.value = 10

or if the string contain a name of a funktion how to run that with the
string

i hope you understand my question
thanks







Bob Phillips[_6_]

Strings
 
Aran,

What exactly do you mean by running a function.

--

HTH

RP
(remove nothere from the email address if mailing direct)


"aran" wrote in message
...
Hello
I find out how to do
ActiveSheet.OLEObjects(str).Visible = True
worked fine

but i still have the question about how to run a funktion


"aran" wrote:

Thanks
Thats worked fine with the value but if i try visible it say that
the method is not supported

And if i like to run a funktion the same way how do i do



"Bob Phillips" wrote:

No problems Aran, just making sure.

I Assumed userform checkbox.

If it is a control toolbox checkbox, use

ActiveSheet.OLEObjects(str).Object.Value = True

If it is a forms checkbox, use

ActiveSheet.CheckBoxes(str).Value = True


--

HTH

RP
(remove nothere from the email address if mailing direct)


"aran" wrote in message
...
Sorry about my example

i have the checkboxes on a worksheet
and when i try your example it say it cant find the method

"controls"

"Bob Phillips" wrote:

Me.Controls(str).Value = True


BTW you cannot set a checbox value to 10, just True or False.

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Aran" wrote in message
...
Hello
I have a question about strings
How do i make the value runnable
ex.
str = "checkbox1"
and i like to use the string instead of the name checkbox1
and do this
checkbox1.value = 10

or if the string contain a name of a funktion how to run that

with the
string

i hope you understand my question
thanks









Aran

Strings
 
Sorry but i have translateproblems
i think maybe subroutine is better
like this

Private Sub Exempl()
str = "Run"

and then to start run
End Sub

Private Sub Run()

End Sub


"Bob Phillips" wrote:

Aran,

What exactly do you mean by running a function.

--

HTH

RP
(remove nothere from the email address if mailing direct)


"aran" wrote in message
...
Hello
I find out how to do
ActiveSheet.OLEObjects(str).Visible = True
worked fine

but i still have the question about how to run a funktion


"aran" wrote:

Thanks
Thats worked fine with the value but if i try visible it say that
the method is not supported

And if i like to run a funktion the same way how do i do



"Bob Phillips" wrote:

No problems Aran, just making sure.

I Assumed userform checkbox.

If it is a control toolbox checkbox, use

ActiveSheet.OLEObjects(str).Object.Value = True

If it is a forms checkbox, use

ActiveSheet.CheckBoxes(str).Value = True


--

HTH

RP
(remove nothere from the email address if mailing direct)


"aran" wrote in message
...
Sorry about my example

i have the checkboxes on a worksheet
and when i try your example it say it cant find the method

"controls"

"Bob Phillips" wrote:

Me.Controls(str).Value = True


BTW you cannot set a checbox value to 10, just True or False.

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Aran" wrote in message
...
Hello
I have a question about strings
How do i make the value runnable
ex.
str = "checkbox1"
and i like to use the string instead of the name checkbox1
and do this
checkbox1.value = 10

or if the string contain a name of a funktion how to run that

with the
string

i hope you understand my question
thanks










Bob Phillips[_6_]

Strings
 
Aran,

Perhaps I have also <vbg

What I mean is that you could easily just drop that code into a
macro/procedure/subroutine whatever you wish to call it, but all of these
need something to trigger them, that is to get them to run. What is it that
you want to do to this code to run?

--

HTH

RP
(remove nothere from the email address if mailing direct)


"aran" wrote in message
...
Sorry but i have translateproblems
i think maybe subroutine is better
like this

Private Sub Exempl()
str = "Run"

and then to start run
End Sub

Private Sub Run()

End Sub


"Bob Phillips" wrote:

Aran,

What exactly do you mean by running a function.

--

HTH

RP
(remove nothere from the email address if mailing direct)


"aran" wrote in message
...
Hello
I find out how to do
ActiveSheet.OLEObjects(str).Visible = True
worked fine

but i still have the question about how to run a funktion


"aran" wrote:

Thanks
Thats worked fine with the value but if i try visible it say that
the method is not supported

And if i like to run a funktion the same way how do i do



"Bob Phillips" wrote:

No problems Aran, just making sure.

I Assumed userform checkbox.

If it is a control toolbox checkbox, use

ActiveSheet.OLEObjects(str).Object.Value = True

If it is a forms checkbox, use

ActiveSheet.CheckBoxes(str).Value = True


--

HTH

RP
(remove nothere from the email address if mailing direct)


"aran" wrote in message
...
Sorry about my example

i have the checkboxes on a worksheet
and when i try your example it say it cant find the method

"controls"

"Bob Phillips" wrote:

Me.Controls(str).Value = True


BTW you cannot set a checbox value to 10, just True or False.

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Aran" wrote in message
...
Hello
I have a question about strings
How do i make the value runnable
ex.
str = "checkbox1"
and i like to use the string instead of the name checkbox1
and do this
checkbox1.value = 10

or if the string contain a name of a funktion how to run

that
with the
string

i hope you understand my question
thanks












Aran

Strings
 
Hello Bob

I have a ComboBox and when i select a value i read the value
and like to call the subroutine like this

CentralComboBox_Change()
Dim str as string
str =CentralComboBox.Value
' and if i select Centralval1 i like that to run
' and if i select Centralval2 i like that to run

End Sub

Private Sub CentralVal1()
' do things
End Sub

Private Sub CentralVal2()
' do other things
End Sub




"Bob Phillips" wrote:

Aran,

Perhaps I have also <vbg

What I mean is that you could easily just drop that code into a
macro/procedure/subroutine whatever you wish to call it, but all of these
need something to trigger them, that is to get them to run. What is it that
you want to do to this code to run?

--

HTH

RP
(remove nothere from the email address if mailing direct)


"aran" wrote in message
...
Sorry but i have translateproblems
i think maybe subroutine is better
like this

Private Sub Exempl()
str = "Run"

and then to start run
End Sub

Private Sub Run()

End Sub


"Bob Phillips" wrote:

Aran,

What exactly do you mean by running a function.

--

HTH

RP
(remove nothere from the email address if mailing direct)


"aran" wrote in message
...
Hello
I find out how to do
ActiveSheet.OLEObjects(str).Visible = True
worked fine

but i still have the question about how to run a funktion


"aran" wrote:

Thanks
Thats worked fine with the value but if i try visible it say that
the method is not supported

And if i like to run a funktion the same way how do i do



"Bob Phillips" wrote:

No problems Aran, just making sure.

I Assumed userform checkbox.

If it is a control toolbox checkbox, use

ActiveSheet.OLEObjects(str).Object.Value = True

If it is a forms checkbox, use

ActiveSheet.CheckBoxes(str).Value = True


--

HTH

RP
(remove nothere from the email address if mailing direct)


"aran" wrote in message
...
Sorry about my example

i have the checkboxes on a worksheet
and when i try your example it say it cant find the method
"controls"

"Bob Phillips" wrote:

Me.Controls(str).Value = True


BTW you cannot set a checbox value to 10, just True or False.

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Aran" wrote in message
...
Hello
I have a question about strings
How do i make the value runnable
ex.
str = "checkbox1"
and i like to use the string instead of the name checkbox1
and do this
checkbox1.value = 10

or if the string contain a name of a funktion how to run

that
with the
string

i hope you understand my question
thanks













Aran

Strings
 
Hello Bob
This is how i mean
the combobox have three choises

Private Sub CentralComboBox_Change()
Dim str As String
str = CentralComboBox.Value
' and for ex. the value is CentralVal2
' will run CentralVal2
' how to do???
End Sub

Private Sub CentralVal1()
'do something
End Sub

Private Sub CentralVal2()
'do something else
End Sub

Private Sub CentralVal3()
'do something else
End Sub

"Bob Phillips" wrote:

Aran,

Perhaps I have also <vbg

What I mean is that you could easily just drop that code into a
macro/procedure/subroutine whatever you wish to call it, but all of these
need something to trigger them, that is to get them to run. What is it that
you want to do to this code to run?

--

HTH

RP
(remove nothere from the email address if mailing direct)


"aran" wrote in message
...
Sorry but i have translateproblems
i think maybe subroutine is better
like this

Private Sub Exempl()
str = "Run"

and then to start run
End Sub

Private Sub Run()

End Sub


"Bob Phillips" wrote:

Aran,

What exactly do you mean by running a function.

--

HTH

RP
(remove nothere from the email address if mailing direct)


"aran" wrote in message
...
Hello
I find out how to do
ActiveSheet.OLEObjects(str).Visible = True
worked fine

but i still have the question about how to run a funktion


"aran" wrote:

Thanks
Thats worked fine with the value but if i try visible it say that
the method is not supported

And if i like to run a funktion the same way how do i do



"Bob Phillips" wrote:

No problems Aran, just making sure.

I Assumed userform checkbox.

If it is a control toolbox checkbox, use

ActiveSheet.OLEObjects(str).Object.Value = True

If it is a forms checkbox, use

ActiveSheet.CheckBoxes(str).Value = True


--

HTH

RP
(remove nothere from the email address if mailing direct)


"aran" wrote in message
...
Sorry about my example

i have the checkboxes on a worksheet
and when i try your example it say it cant find the method
"controls"

"Bob Phillips" wrote:

Me.Controls(str).Value = True


BTW you cannot set a checbox value to 10, just True or False.

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Aran" wrote in message
...
Hello
I have a question about strings
How do i make the value runnable
ex.
str = "checkbox1"
and i like to use the string instead of the name checkbox1
and do this
checkbox1.value = 10

or if the string contain a name of a funktion how to run

that
with the
string

i hope you understand my question
thanks













Aran

Strings
 
Hello Bob
What i want to do is

I have one combobox where i can chose a value
i then use combobox linkedcell to get a number
the other subroutines have i named choice1, choice2, and so on
when that is done i like to run the subroutine that match the value
of the other subroutines
i have named them choice1, choice2, and so on
that subroutine runs another where i use the code you helped me with

Private Sub CentralComboBox_Change()
'
End Sub
Private Sub CentralVal1()
'here i call other sub's
End Sub
Private Sub CentralVal2()
'here i call other sub's
End Sub


"Bob Phillips" wrote:

Aran,

Perhaps I have also <vbg

What I mean is that you could easily just drop that code into a
macro/procedure/subroutine whatever you wish to call it, but all of these
need something to trigger them, that is to get them to run. What is it that
you want to do to this code to run?

--

HTH

RP
(remove nothere from the email address if mailing direct)


"aran" wrote in message
...
Sorry but i have translateproblems
i think maybe subroutine is better
like this

Private Sub Exempl()
str = "Run"

and then to start run
End Sub

Private Sub Run()

End Sub


"Bob Phillips" wrote:

Aran,

What exactly do you mean by running a function.

--

HTH

RP
(remove nothere from the email address if mailing direct)


"aran" wrote in message
...
Hello
I find out how to do
ActiveSheet.OLEObjects(str).Visible = True
worked fine

but i still have the question about how to run a funktion


"aran" wrote:

Thanks
Thats worked fine with the value but if i try visible it say that
the method is not supported

And if i like to run a funktion the same way how do i do



"Bob Phillips" wrote:

No problems Aran, just making sure.

I Assumed userform checkbox.

If it is a control toolbox checkbox, use

ActiveSheet.OLEObjects(str).Object.Value = True

If it is a forms checkbox, use

ActiveSheet.CheckBoxes(str).Value = True


--

HTH

RP
(remove nothere from the email address if mailing direct)


"aran" wrote in message
...
Sorry about my example

i have the checkboxes on a worksheet
and when i try your example it say it cant find the method
"controls"

"Bob Phillips" wrote:

Me.Controls(str).Value = True


BTW you cannot set a checbox value to 10, just True or False.

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Aran" wrote in message
...
Hello
I have a question about strings
How do i make the value runnable
ex.
str = "checkbox1"
and i like to use the string instead of the name checkbox1
and do this
checkbox1.value = 10

or if the string contain a name of a funktion how to run

that
with the
string

i hope you understand my question
thanks













Aran

Strings
 
test 4 to post
Hello Bob
What i want to do is

I have one combobox where i can chose a value
i then use combobox linkedcell to get a number
the other subroutines have i named choice1, choice2, and so on
when that is done i like to run the subroutine that match the value
of the other subroutines
i have named them choice1, choice2, and so on
that subroutine runs another where i use the code you helped me with

Private Sub CentralComboBox_Change()
'
End Sub
Private Sub CentralVal1()
'here i call other sub's
End Sub
Private Sub CentralVal2()
'here i call other sub's
End Sub


"Aran" wrote:

Hello
I have a question about strings
How do i make the value runnable
ex.
str = "checkbox1"
and i like to use the string instead of the name checkbox1
and do this
checkbox1.value = 10

or if the string contain a name of a funktion how to run that with the string

i hope you understand my question
thanks



All times are GMT +1. The time now is 09:53 AM.

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