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

On my userform initialize code, I want to have the checkbox value to be true
(checked) if there is something in the referenced cell. I populate my
textboxes with:

TextBox5.Text = rng(1, 2).Value

but not sure how to do this with a checkbox.


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Checkbox question

Maybe something like:

Option Explicit
Private Sub UserForm_Initialize()
Me.CheckBox1.Value = CBool(Worksheets("sheet1").Range("a1").Value < "")
End Sub



Patrick Simonds wrote:

On my userform initialize code, I want to have the checkbox value to be true
(checked) if there is something in the referenced cell. I populate my
textboxes with:

TextBox5.Text = rng(1, 2).Value

but not sure how to do this with a checkbox.


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 258
Default Checkbox question

I can not reference a set cell, it will always go to the same column, but
the row will be determined by which row the curser is on. That is why I was
trying the rng(1, 2). For this Checkbox it will always look at column 2 of
the current row.



"Dave Peterson" wrote in message
...
Maybe something like:

Option Explicit
Private Sub UserForm_Initialize()
Me.CheckBox1.Value = CBool(Worksheets("sheet1").Range("a1").Value <
"")
End Sub



Patrick Simonds wrote:

On my userform initialize code, I want to have the checkbox value to be
true
(checked) if there is something in the referenced cell. I populate my
textboxes with:

TextBox5.Text = rng(1, 2).Value

but not sure how to do this with a checkbox.


--

Dave Peterson



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 258
Default Checkbox question

I should mention that I use the following to define rng:

Dim rng
Set rng = Cells(ActiveCell.Row, 1)


"Patrick Simonds" wrote in message
...
I can not reference a set cell, it will always go to the same column, but
the row will be determined by which row the curser is on. That is why I
was trying the rng(1, 2). For this Checkbox it will always look at column
2 of the current row.



"Dave Peterson" wrote in message
...
Maybe something like:

Option Explicit
Private Sub UserForm_Initialize()
Me.CheckBox1.Value = CBool(Worksheets("sheet1").Range("a1").Value <
"")
End Sub



Patrick Simonds wrote:

On my userform initialize code, I want to have the checkbox value to be
true
(checked) if there is something in the referenced cell. I populate my
textboxes with:

TextBox5.Text = rng(1, 2).Value

but not sure how to do this with a checkbox.


--

Dave Peterson





  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,092
Default Checkbox question

Try Daves solution with these modifications:

Option Explicit
Public rng As Range
Private Sub UserForm_Initialize()
Me.CheckBox1.Value = CBool(Worksheets("sheet1").Range(rng).Value < "")
End Sub

Mike F

"Patrick Simonds" wrote in message
...
I should mention that I use the following to define rng:

Dim rng
Set rng = Cells(ActiveCell.Row, 1)


"Patrick Simonds" wrote in message
...
I can not reference a set cell, it will always go to the same column, but
the row will be determined by which row the curser is on. That is why I
was trying the rng(1, 2). For this Checkbox it will always look at column
2 of the current row.



"Dave Peterson" wrote in message
...
Maybe something like:

Option Explicit
Private Sub UserForm_Initialize()
Me.CheckBox1.Value = CBool(Worksheets("sheet1").Range("a1").Value <
"")
End Sub



Patrick Simonds wrote:

On my userform initialize code, I want to have the checkbox value to be
true
(checked) if there is something in the referenced cell. I populate my
textboxes with:

TextBox5.Text = rng(1, 2).Value

but not sure how to do this with a checkbox.

--

Dave Peterson









  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Checkbox question

or maybe:


Option Explicit
Private Sub UserForm_Initialize()
dim rng as range
Set rng = activesheet.Cells(ActiveCell.Row, 1)
Me.CheckBox1.Value = CBool(rng(1,2).Value < "")
End Sub



Patrick Simonds wrote:

I should mention that I use the following to define rng:

Dim rng
Set rng = Cells(ActiveCell.Row, 1)

"Patrick Simonds" wrote in message
...
I can not reference a set cell, it will always go to the same column, but
the row will be determined by which row the curser is on. That is why I
was trying the rng(1, 2). For this Checkbox it will always look at column
2 of the current row.



"Dave Peterson" wrote in message
...
Maybe something like:

Option Explicit
Private Sub UserForm_Initialize()
Me.CheckBox1.Value = CBool(Worksheets("sheet1").Range("a1").Value <
"")
End Sub



Patrick Simonds wrote:

On my userform initialize code, I want to have the checkbox value to be
true
(checked) if there is something in the referenced cell. I populate my
textboxes with:

TextBox5.Text = rng(1, 2).Value

but not sure how to do this with a checkbox.

--

Dave Peterson




--

Dave Peterson
  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 258
Default Checkbox question

I want to thank you all, Me.CheckBox1.Value = CBool(rng(1,2).Value < "")
was what it took to make this work.


"Dave Peterson" wrote in message
...
or maybe:


Option Explicit
Private Sub UserForm_Initialize()
dim rng as range
Set rng = activesheet.Cells(ActiveCell.Row, 1)
Me.CheckBox1.Value = CBool(rng(1,2).Value < "")
End Sub



Patrick Simonds wrote:

I should mention that I use the following to define rng:

Dim rng
Set rng = Cells(ActiveCell.Row, 1)

"Patrick Simonds" wrote in message
...
I can not reference a set cell, it will always go to the same column,
but
the row will be determined by which row the curser is on. That is why I
was trying the rng(1, 2). For this Checkbox it will always look at
column
2 of the current row.



"Dave Peterson" wrote in message
...
Maybe something like:

Option Explicit
Private Sub UserForm_Initialize()
Me.CheckBox1.Value = CBool(Worksheets("sheet1").Range("a1").Value
<
"")
End Sub



Patrick Simonds wrote:

On my userform initialize code, I want to have the checkbox value to
be
true
(checked) if there is something in the referenced cell. I populate my
textboxes with:

TextBox5.Text = rng(1, 2).Value

but not sure how to do this with a checkbox.

--

Dave Peterson



--

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
Checkbox Question slow386 Excel Discussion (Misc queries) 7 July 21st 07 12:06 AM
Checkbox Question MCrum Excel Discussion (Misc queries) 1 January 15th 07 12:38 PM
Checkbox question Adam Kroger Excel Discussion (Misc queries) 0 December 19th 05 12:41 PM
CheckBox question Frank Rudd via OfficeKB.com Excel Programming 2 July 1st 05 12:35 AM
CheckBox question Sheldon Excel Programming 6 January 25th 05 05:11 PM


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

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"