Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 273
Default How To Get The State Of A CheckBox

Greetings,

Anyone know what the syntax would be to determine the state of a
CheckBox (CBX1) that I have on a UserForm?

TIA

-Minitman
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,885
Default How To Get The State Of A CheckBox

cbx1.value

--
Regards
Frank Kabel
Frankfurt, Germany

"Minitman" schrieb im Newsbeitrag
...
Greetings,

Anyone know what the syntax would be to determine the state of a
CheckBox (CBX1) that I have on a UserForm?

TIA

-Minitman


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 863
Default How To Get The State Of A CheckBox

Test the Value property of the CheckBox object. There are examples in Help for
setting the value. I assume you can figure out from that how to read it <g.


On Tue, 26 Oct 2004 16:55:38 -0500, Minitman wrote:

Greetings,

Anyone know what the syntax would be to determine the state of a
CheckBox (CBX1) that I have on a UserForm?

TIA

-Minitman


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 273
Default How To Get The State Of A CheckBox

Thanks Frank

-Minitman

On Tue, 26 Oct 2004 23:58:01 +0200, "Frank Kabel"
wrote:

cbx1.value


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 273
Default How To Get The State Of A CheckBox

Hey Frank,

I am attempting to put a "Y" on my spreadsheet if cbx1.value is true
and nothing if it is false. I can't seem to get it from the userform
to the spreadsheet.

Any ideas?

-Minitman



On Tue, 26 Oct 2004 23:58:01 +0200, "Frank Kabel"
wrote:

cbx1.value




  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default How To Get The State Of A CheckBox

Private Sub cbx1_click()
if cbx1.Value then
worksheets("Sheet1").Range("A1").Value = "Y"
else
worksheets("Sheet1").Range("A1").ClearContents
end if
end Sub

--
Regards,
Tom Ogilvy

"Minitman" wrote in message
...
Hey Frank,

I am attempting to put a "Y" on my spreadsheet if cbx1.value is true
and nothing if it is false. I can't seem to get it from the userform
to the spreadsheet.

Any ideas?

-Minitman



On Tue, 26 Oct 2004 23:58:01 +0200, "Frank Kabel"
wrote:

cbx1.value




  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 273
Default How To Get The State Of A CheckBox

Hey Tom,

It's a bit more complicated then that i'm afraid.

The paste down is done within a With statement. using the cbx1.value
I can get "TRUE" in the correct column. All of my code on the sheet
is looking for a "Y" not a "TRUE". I was looking for a way to convert
the "TRUE" to a "Y" before it pasted down with the rest of the row.

Oh, in case I forgot to mention it, thanks for the assist on finding
the sheet with the mmm-yy formatted name tabs. I finally got that
section working (this is in the same UserForm).

I am looking for a simple solution, if there is no "simple" solution,
then I can go into the sheet formulas and change them to look for
"TRUE" instead of "Y"

TIA

-Minitman


On Tue, 26 Oct 2004 19:34:55 -0400, "Tom Ogilvy"
wrote:

Private Sub cbx1_click()
if cbx1.Value then
worksheets("Sheet1").Range("A1").Value = "Y"
else
worksheets("Sheet1").Range("A1").ClearContents
end if
end Sub


  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default How To Get The State Of A CheckBox

If, by paste down, you mean you have set the controlsource property to a
cell, then the value in that cell will be True or False. It will only be
blank if no selection has been made. You can not make the cell contain "Y"
or anything else by using the controlsource property.

Otherwise, you will have to show what code you are using (that demonstrates
the terminology paste down) that makes it more complicated than that.

--
Regards,
Tom Ogilvy


"Minitman" wrote in message
...
Hey Tom,

It's a bit more complicated then that i'm afraid.

The paste down is done within a With statement. using the cbx1.value
I can get "TRUE" in the correct column. All of my code on the sheet
is looking for a "Y" not a "TRUE". I was looking for a way to convert
the "TRUE" to a "Y" before it pasted down with the rest of the row.

Oh, in case I forgot to mention it, thanks for the assist on finding
the sheet with the mmm-yy formatted name tabs. I finally got that
section working (this is in the same UserForm).

I am looking for a simple solution, if there is no "simple" solution,
then I can go into the sheet formulas and change them to look for
"TRUE" instead of "Y"

TIA

-Minitman


On Tue, 26 Oct 2004 19:34:55 -0400, "Tom Ogilvy"
wrote:

Private Sub cbx1_click()
if cbx1.Value then
worksheets("Sheet1").Range("A1").Value = "Y"
else
worksheets("Sheet1").Range("A1").ClearContents
end if
end Sub




  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 273
Default How To Get The State Of A CheckBox

Ok, here is the short version

Private Sub SaveButton_Click()

Dim dt As Date
Dim sh As Worksheet
dt = CDate(TextBox1.Text)
Set sh = Worksheets(Format(dt, "mmm-yy"))
sh.Activate

With Range("A65536").End(xlUp).Offset(1, 0)
.Value = TextBox1.Text
.Offset(0, 1).Value = TextBox2.Text
.Offset(0, 2).Value = CBox1.Text
.Offset(0, 3).Value = CBox2.Text
  #10   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,824
Default How To Get The State Of A CheckBox

.Offset(0, 11).Value = CBX1.Value <<<<<<

could become:

if cbx1.value = true then
.Offset(0, 11).Value = "y"
else
.offset(0,11).value = "n"
end if


But looking back through the older posts, this looks a lot like the code that
Tom originally posted.





Minitman wrote:

Ok, here is the short version

Private Sub SaveButton_Click()

Dim dt As Date
Dim sh As Worksheet
dt = CDate(TextBox1.Text)
Set sh = Worksheets(Format(dt, "mmm-yy"))
sh.Activate

With Range("A65536").End(xlUp).Offset(1, 0)
.Value = TextBox1.Text
.Offset(0, 1).Value = TextBox2.Text
.Offset(0, 2).Value = CBox1.Text
.Offset(0, 3).Value = CBox2.Text
.
.
.
.Offset(0, 10).Value = TextBox6.Text
.Offset(0, 11).Value = CBX1.Value <<<<<<
.Offset(0, 12).Value = TextBox7.Text
.
.
.
.Offset(0, 16).Value = TextBox14.Text
End With
End Sub

The dots indicate more of the same.

Thanks for looking at it.

-Minitman

On Tue, 26 Oct 2004 19:58:04 -0400, "Tom Ogilvy"
wrote:

If, by paste down, you mean you have set the controlsource property to a
cell, then the value in that cell will be True or False. It will only be
blank if no selection has been made. You can not make the cell contain "Y"
or anything else by using the controlsource property.

Otherwise, you will have to show what code you are using (that demonstrates
the terminology paste down) that makes it more complicated than that.


--

Dave Peterson



  #11   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 273
Default How To Get The State Of A CheckBox - Solved

Hey Dave,

Thanks, this looks like it will do the job.

As for the code from Tom, he did indeed sent this portion:

Dim dt As Date
Dim sh As Worksheet
dt = CDate(TextBox1.Text)
Set sh = Worksheets(Format(dt, "mmm-yy"))

I believe Tom sent it on Thu, 21 Oct 2004. It is part of the last
element of my UserForm (the Save button), the offset part someone
helped me with last year sometime. A lot of Tom's code is woven
though-out my projects as well as the work of many others/

In fact this NG has been very helpful in my attempt at programming (I
am not a programmer, only a wanna be<g). With all of your help, I
have finished this project and can now start to enter in the last 11
years of bank deposits.

My next project is to finish a Income projection workbook which I have
been working on since 1988 (started in Quartro Pro). I have learned
so much from this NG that I now can totally rewrite this project.

Again, my deepest thanks to all of you who so unselfishly give of your
time and knowledge to those of us who really don't have a clue. <G

-Minitman

On Tue, 26 Oct 2004 21:09:55 -0500, Dave Peterson
wrote:

.Offset(0, 11).Value = CBX1.Value <<<<<<

could become:

if cbx1.value = true then
.Offset(0, 11).Value = "y"
else
.offset(0,11).value = "n"
end if


But looking back through the older posts, this looks a lot like the code that
Tom originally posted.





Minitman wrote:

Ok, here is the short version

Private Sub SaveButton_Click()

Dim dt As Date
Dim sh As Worksheet
dt = CDate(TextBox1.Text)
Set sh = Worksheets(Format(dt, "mmm-yy"))
sh.Activate

With Range("A65536").End(xlUp).Offset(1, 0)
.Value = TextBox1.Text
.Offset(0, 1).Value = TextBox2.Text
.Offset(0, 2).Value = CBox1.Text
.Offset(0, 3).Value = CBox2.Text
.
.
.
.Offset(0, 10).Value = TextBox6.Text
.Offset(0, 11).Value = CBX1.Value <<<<<<
.Offset(0, 12).Value = TextBox7.Text
.
.
.
.Offset(0, 16).Value = TextBox14.Text
End With
End Sub

The dots indicate more of the same.

Thanks for looking at it.

-Minitman

On Tue, 26 Oct 2004 19:58:04 -0400, "Tom Ogilvy"
wrote:

If, by paste down, you mean you have set the controlsource property to a
cell, then the value in that cell will be True or False. It will only be
blank if no selection has been made. You can not make the cell contain "Y"
or anything else by using the controlsource property.

Otherwise, you will have to show what code you are using (that demonstrates
the terminology paste down) that makes it more complicated than that.


  #12   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,824
Default How To Get The State Of A CheckBox - Solved

This is the code that Tom sent on the Oct 26:

Private Sub cbx1_click()
if cbx1.Value then
worksheets("Sheet1").Range("A1").Value = "Y"
else
worksheets("Sheet1").Range("A1").ClearContents
end if
end Sub

I use Netscape Messenger for my newsreader. From your headers, I see you use
Forte Agent. Tom's post is in the middle of this thread for me.

But glad you got it working.


Minitman wrote:

Hey Dave,

Thanks, this looks like it will do the job.

As for the code from Tom, he did indeed sent this portion:

Dim dt As Date
Dim sh As Worksheet
dt = CDate(TextBox1.Text)
Set sh = Worksheets(Format(dt, "mmm-yy"))

I believe Tom sent it on Thu, 21 Oct 2004. It is part of the last
element of my UserForm (the Save button), the offset part someone
helped me with last year sometime. A lot of Tom's code is woven
though-out my projects as well as the work of many others/

In fact this NG has been very helpful in my attempt at programming (I
am not a programmer, only a wanna be<g). With all of your help, I
have finished this project and can now start to enter in the last 11
years of bank deposits.

My next project is to finish a Income projection workbook which I have
been working on since 1988 (started in Quartro Pro). I have learned
so much from this NG that I now can totally rewrite this project.

Again, my deepest thanks to all of you who so unselfishly give of your
time and knowledge to those of us who really don't have a clue. <G

-Minitman

On Tue, 26 Oct 2004 21:09:55 -0500, Dave Peterson
wrote:

.Offset(0, 11).Value = CBX1.Value <<<<<<

could become:

if cbx1.value = true then
.Offset(0, 11).Value = "y"
else
.offset(0,11).value = "n"
end if


But looking back through the older posts, this looks a lot like the code that
Tom originally posted.





Minitman wrote:

Ok, here is the short version

Private Sub SaveButton_Click()

Dim dt As Date
Dim sh As Worksheet
dt = CDate(TextBox1.Text)
Set sh = Worksheets(Format(dt, "mmm-yy"))
sh.Activate

With Range("A65536").End(xlUp).Offset(1, 0)
.Value = TextBox1.Text
.Offset(0, 1).Value = TextBox2.Text
.Offset(0, 2).Value = CBox1.Text
.Offset(0, 3).Value = CBox2.Text
.
.
.
.Offset(0, 10).Value = TextBox6.Text
.Offset(0, 11).Value = CBX1.Value <<<<<<
.Offset(0, 12).Value = TextBox7.Text
.
.
.
.Offset(0, 16).Value = TextBox14.Text
End With
End Sub

The dots indicate more of the same.

Thanks for looking at it.

-Minitman

On Tue, 26 Oct 2004 19:58:04 -0400, "Tom Ogilvy"
wrote:

If, by paste down, you mean you have set the controlsource property to a
cell, then the value in that cell will be True or False. It will only be
blank if no selection has been made. You can not make the cell contain "Y"
or anything else by using the controlsource property.

Otherwise, you will have to show what code you are using (that demonstrates
the terminology paste down) that makes it more complicated than that.


--

Dave Peterson

  #13   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 273
Default How To Get The State Of A CheckBox - Solved

Hey Dave,

Yes I remember now, I could not use it because there was no way to
tell it where to place the letter Y. I am using this UserForm to fill
in 132 sheets and the determining factor as to which sheet is
selected, is the Deposit Date (sheet tabs are labeled as dates in the
mmm-yy format). It is placed on the last row of column L. It was
easier to do the placement of all of the data when the form was filled
out.

It was working very well, until I got to tweaking it!!!

But that will be the subject of my next cry for help. <G

-Minitman

On Wed, 27 Oct 2004 08:22:49 -0500, Dave Peterson
wrote:

This is the code that Tom sent on the Oct 26:

Private Sub cbx1_click()
if cbx1.Value then
worksheets("Sheet1").Range("A1").Value = "Y"
else
worksheets("Sheet1").Range("A1").ClearContents
end if
end Sub

I use Netscape Messenger for my newsreader. From your headers, I see you use
Forte Agent. Tom's post is in the middle of this thread for me.

But glad you got it working.


Minitman wrote:

Hey Dave,

Thanks, this looks like it will do the job.

As for the code from Tom, he did indeed sent this portion:

Dim dt As Date
Dim sh As Worksheet
dt = CDate(TextBox1.Text)
Set sh = Worksheets(Format(dt, "mmm-yy"))

I believe Tom sent it on Thu, 21 Oct 2004. It is part of the last
element of my UserForm (the Save button), the offset part someone
helped me with last year sometime. A lot of Tom's code is woven
though-out my projects as well as the work of many others/

In fact this NG has been very helpful in my attempt at programming (I
am not a programmer, only a wanna be<g). With all of your help, I
have finished this project and can now start to enter in the last 11
years of bank deposits.

My next project is to finish a Income projection workbook which I have
been working on since 1988 (started in Quartro Pro). I have learned
so much from this NG that I now can totally rewrite this project.

Again, my deepest thanks to all of you who so unselfishly give of your
time and knowledge to those of us who really don't have a clue. <G

-Minitman

On Tue, 26 Oct 2004 21:09:55 -0500, Dave Peterson
wrote:

.Offset(0, 11).Value = CBX1.Value <<<<<<

could become:

if cbx1.value = true then
.Offset(0, 11).Value = "y"
else
.offset(0,11).value = "n"
end if


But looking back through the older posts, this looks a lot like the code that
Tom originally posted.





Minitman wrote:

Ok, here is the short version

Private Sub SaveButton_Click()

Dim dt As Date
Dim sh As Worksheet
dt = CDate(TextBox1.Text)
Set sh = Worksheets(Format(dt, "mmm-yy"))
sh.Activate

With Range("A65536").End(xlUp).Offset(1, 0)
.Value = TextBox1.Text
.Offset(0, 1).Value = TextBox2.Text
.Offset(0, 2).Value = CBox1.Text
.Offset(0, 3).Value = CBox2.Text
.
.
.
.Offset(0, 10).Value = TextBox6.Text
.Offset(0, 11).Value = CBX1.Value <<<<<<
.Offset(0, 12).Value = TextBox7.Text
.
.
.
.Offset(0, 16).Value = TextBox14.Text
End With
End Sub

The dots indicate more of the same.

Thanks for looking at it.

-Minitman

On Tue, 26 Oct 2004 19:58:04 -0400, "Tom Ogilvy"
wrote:

If, by paste down, you mean you have set the controlsource property to a
cell, then the value in that cell will be True or False. It will only be
blank if no selection has been made. You can not make the cell contain "Y"
or anything else by using the controlsource property.

Otherwise, you will have to show what code you are using (that demonstrates
the terminology paste down) that makes it more complicated than that.


  #14   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,824
Default How To Get The State Of A CheckBox - Solved

Glad you got it working...


Minitman wrote:

Hey Dave,

Yes I remember now, I could not use it because there was no way to
tell it where to place the letter Y. I am using this UserForm to fill
in 132 sheets and the determining factor as to which sheet is
selected, is the Deposit Date (sheet tabs are labeled as dates in the
mmm-yy format). It is placed on the last row of column L. It was
easier to do the placement of all of the data when the form was filled
out.

It was working very well, until I got to tweaking it!!!

But that will be the subject of my next cry for help. <G

-Minitman

On Wed, 27 Oct 2004 08:22:49 -0500, Dave Peterson
wrote:

This is the code that Tom sent on the Oct 26:

Private Sub cbx1_click()
if cbx1.Value then
worksheets("Sheet1").Range("A1").Value = "Y"
else
worksheets("Sheet1").Range("A1").ClearContents
end if
end Sub

I use Netscape Messenger for my newsreader. From your headers, I see you use
Forte Agent. Tom's post is in the middle of this thread for me.

But glad you got it working.


Minitman wrote:

Hey Dave,

Thanks, this looks like it will do the job.

As for the code from Tom, he did indeed sent this portion:

Dim dt As Date
Dim sh As Worksheet
dt = CDate(TextBox1.Text)
Set sh = Worksheets(Format(dt, "mmm-yy"))

I believe Tom sent it on Thu, 21 Oct 2004. It is part of the last
element of my UserForm (the Save button), the offset part someone
helped me with last year sometime. A lot of Tom's code is woven
though-out my projects as well as the work of many others/

In fact this NG has been very helpful in my attempt at programming (I
am not a programmer, only a wanna be<g). With all of your help, I
have finished this project and can now start to enter in the last 11
years of bank deposits.

My next project is to finish a Income projection workbook which I have
been working on since 1988 (started in Quartro Pro). I have learned
so much from this NG that I now can totally rewrite this project.

Again, my deepest thanks to all of you who so unselfishly give of your
time and knowledge to those of us who really don't have a clue. <G

-Minitman

On Tue, 26 Oct 2004 21:09:55 -0500, Dave Peterson
wrote:

.Offset(0, 11).Value = CBX1.Value <<<<<<

could become:

if cbx1.value = true then
.Offset(0, 11).Value = "y"
else
.offset(0,11).value = "n"
end if


But looking back through the older posts, this looks a lot like the code that
Tom originally posted.





Minitman wrote:

Ok, here is the short version

Private Sub SaveButton_Click()

Dim dt As Date
Dim sh As Worksheet
dt = CDate(TextBox1.Text)
Set sh = Worksheets(Format(dt, "mmm-yy"))
sh.Activate

With Range("A65536").End(xlUp).Offset(1, 0)
.Value = TextBox1.Text
.Offset(0, 1).Value = TextBox2.Text
.Offset(0, 2).Value = CBox1.Text
.Offset(0, 3).Value = CBox2.Text
.
.
.
.Offset(0, 10).Value = TextBox6.Text
.Offset(0, 11).Value = CBX1.Value <<<<<<
.Offset(0, 12).Value = TextBox7.Text
.
.
.
.Offset(0, 16).Value = TextBox14.Text
End With
End Sub

The dots indicate more of the same.

Thanks for looking at it.

-Minitman

On Tue, 26 Oct 2004 19:58:04 -0400, "Tom Ogilvy"
wrote:

If, by paste down, you mean you have set the controlsource property to a
cell, then the value in that cell will be True or False. It will only be
blank if no selection has been made. You can not make the cell contain "Y"
or anything else by using the controlsource property.

Otherwise, you will have to show what code you are using (that demonstrates
the terminology paste down) that makes it more complicated than that.


--

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 do you assess the state of a form-checkbox in a logic statemen jvatlanta Excel Worksheet Functions 1 August 4th 09 05:13 PM
replace state names with state code abbreviations se7098 Excel Worksheet Functions 3 July 25th 09 06:41 PM
How can I show state-by-state data (as silos) on a map of NA Rob Charts and Charting in Excel 0 November 5th 07 03:41 PM
Converting State Names to State Abbreviations aznate Excel Discussion (Misc queries) 1 October 20th 06 06:52 AM
testing the state of a checkbox in vba code Paul James[_3_] Excel Programming 10 December 5th 03 07:55 PM


All times are GMT +1. The time now is 03:59 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"