Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Check Box in Forms

I'm sure my missing something, but I created a Form which adds records to a
worksheet. I have a series of check boxes in the form. When it records the
record it uses True or False. I'm trying to have it set as a numeric 1 or 0.
I've sreached around a bit but haven't found the property setting to
accomplish this. Needless to say my code writing skills are virtually
non-existent so.... any help would be appreciated. Thanks.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 100
Default Check Box in Forms

Hi giardina,

Try using another Variable, as follows:

Sub GetCheckBoxValue()
Dim NumerValue As Integer

If CheckBox1.Value = True Then
NumberValue = 1
Else
NumberValue = 0
End If

End Sub

Hope this helps,

--
A. Ch. Eirinberg


"giardina" wrote:

I'm sure my missing something, but I created a Form which adds records to a
worksheet. I have a series of check boxes in the form. When it records the
record it uses True or False. I'm trying to have it set as a numeric 1 or 0.
I've sreached around a bit but haven't found the property setting to
accomplish this. Needless to say my code writing skills are virtually
non-existent so.... any help would be appreciated. Thanks.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Check Box in Forms

Thanks for the reply. This is what I have where Q() are the check boxes.
After copying to the weeksheet the form clears for the next entry. I'm not
sure how/where I would incorporate that sub.(?)

Private Sub cmdAdd_Click()
Dim iRow As Long
Dim ws As Worksheet
Set ws = Worksheets("WarrQAdata")

'copy the data to the worksheet
ws.Cells(iRow, 5).Value = Me.Q1.Value
ws.Cells(iRow, 6).Value = Me.Q2.Value
ws.Cells(iRow, 7).Value = Me.Q3.Value

'clear the data
Me.Q1.Value = "True"
Me.Q2.Value = "True"
Me.Q3.Value = "True"

End Sub



"Howard31" wrote:

Hi giardina,

Try using another Variable, as follows:

Sub GetCheckBoxValue()
Dim NumerValue As Integer

If CheckBox1.Value = True Then
NumberValue = 1
Else
NumberValue = 0
End If

End Sub

Hope this helps,

--
A. Ch. Eirinberg


"giardina" wrote:

I'm sure my missing something, but I created a Form which adds records to a
worksheet. I have a series of check boxes in the form. When it records the
record it uses True or False. I'm trying to have it set as a numeric 1 or 0.
I've sreached around a bit but haven't found the property setting to
accomplish this. Needless to say my code writing skills are virtually
non-existent so.... any help would be appreciated. Thanks.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Check Box in Forms

In a worksheet, excel treats True as 1 in arithmetic operations.

But in VBA, excel treats True as -1 in arithmetic operations.

Option Explicit
Private Sub cmdAdd_Click()
Dim iRow As Long
Dim ws As Worksheet
Set ws = Worksheets("WarrQAdata")

iRow = 6 'for testing

'copy the data to the worksheet
ws.Cells(iRow, 5).Value = -1 * Me.Q1.Value
ws.Cells(iRow, 6).Value = -1 * Me.Q2.Value
ws.Cells(iRow, 7).Value = -1 * Me.Q3.Value

'clear the data
Me.Q1.Value = False
Me.Q2.Value = False
Me.Q3.Value = False

End Sub

giardina wrote:

Thanks for the reply. This is what I have where Q() are the check boxes.
After copying to the weeksheet the form clears for the next entry. I'm not
sure how/where I would incorporate that sub.(?)

Private Sub cmdAdd_Click()
Dim iRow As Long
Dim ws As Worksheet
Set ws = Worksheets("WarrQAdata")

'copy the data to the worksheet
ws.Cells(iRow, 5).Value = Me.Q1.Value
ws.Cells(iRow, 6).Value = Me.Q2.Value
ws.Cells(iRow, 7).Value = Me.Q3.Value

'clear the data
Me.Q1.Value = "True"
Me.Q2.Value = "True"
Me.Q3.Value = "True"

End Sub

"Howard31" wrote:

Hi giardina,

Try using another Variable, as follows:

Sub GetCheckBoxValue()
Dim NumerValue As Integer

If CheckBox1.Value = True Then
NumberValue = 1
Else
NumberValue = 0
End If

End Sub

Hope this helps,

--
A. Ch. Eirinberg


"giardina" wrote:

I'm sure my missing something, but I created a Form which adds records to a
worksheet. I have a series of check boxes in the form. When it records the
record it uses True or False. I'm trying to have it set as a numeric 1 or 0.
I've sreached around a bit but haven't found the property setting to
accomplish this. Needless to say my code writing skills are virtually
non-existent so.... any help would be appreciated. Thanks.


--

Dave Peterson
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Check Box in Forms

Dave,

Thanks. I spent the afternoon on that. I just put the -1*Me.Q().Value and it
worked.
Learning can be a real b.

"Dave Peterson" wrote:

In a worksheet, excel treats True as 1 in arithmetic operations.

But in VBA, excel treats True as -1 in arithmetic operations.

Option Explicit
Private Sub cmdAdd_Click()
Dim iRow As Long
Dim ws As Worksheet
Set ws = Worksheets("WarrQAdata")

iRow = 6 'for testing

'copy the data to the worksheet
ws.Cells(iRow, 5).Value = -1 * Me.Q1.Value
ws.Cells(iRow, 6).Value = -1 * Me.Q2.Value
ws.Cells(iRow, 7).Value = -1 * Me.Q3.Value

'clear the data
Me.Q1.Value = False
Me.Q2.Value = False
Me.Q3.Value = False

End Sub

giardina wrote:

Thanks for the reply. This is what I have where Q() are the check boxes.
After copying to the weeksheet the form clears for the next entry. I'm not
sure how/where I would incorporate that sub.(?)

Private Sub cmdAdd_Click()
Dim iRow As Long
Dim ws As Worksheet
Set ws = Worksheets("WarrQAdata")

'copy the data to the worksheet
ws.Cells(iRow, 5).Value = Me.Q1.Value
ws.Cells(iRow, 6).Value = Me.Q2.Value
ws.Cells(iRow, 7).Value = Me.Q3.Value

'clear the data
Me.Q1.Value = "True"
Me.Q2.Value = "True"
Me.Q3.Value = "True"

End Sub

"Howard31" wrote:

Hi giardina,

Try using another Variable, as follows:

Sub GetCheckBoxValue()
Dim NumerValue As Integer

If CheckBox1.Value = True Then
NumberValue = 1
Else
NumberValue = 0
End If

End Sub

Hope this helps,

--
A. Ch. Eirinberg


"giardina" wrote:

I'm sure my missing something, but I created a Form which adds records to a
worksheet. I have a series of check boxes in the form. When it records the
record it uses True or False. I'm trying to have it set as a numeric 1 or 0.
I've sreached around a bit but haven't found the property setting to
accomplish this. Needless to say my code writing skills are virtually
non-existent so.... any help would be appreciated. Thanks.


--

Dave Peterson



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Check Box in Forms

You didn't really include () in your expression:
-1*Me.Q().Value

did you????

giardina wrote:

Dave,

Thanks. I spent the afternoon on that. I just put the -1*Me.Q().Value and it
worked.
Learning can be a real b.

"Dave Peterson" wrote:

In a worksheet, excel treats True as 1 in arithmetic operations.

But in VBA, excel treats True as -1 in arithmetic operations.

Option Explicit
Private Sub cmdAdd_Click()
Dim iRow As Long
Dim ws As Worksheet
Set ws = Worksheets("WarrQAdata")

iRow = 6 'for testing

'copy the data to the worksheet
ws.Cells(iRow, 5).Value = -1 * Me.Q1.Value
ws.Cells(iRow, 6).Value = -1 * Me.Q2.Value
ws.Cells(iRow, 7).Value = -1 * Me.Q3.Value

'clear the data
Me.Q1.Value = False
Me.Q2.Value = False
Me.Q3.Value = False

End Sub

giardina wrote:

Thanks for the reply. This is what I have where Q() are the check boxes.
After copying to the weeksheet the form clears for the next entry. I'm not
sure how/where I would incorporate that sub.(?)

Private Sub cmdAdd_Click()
Dim iRow As Long
Dim ws As Worksheet
Set ws = Worksheets("WarrQAdata")

'copy the data to the worksheet
ws.Cells(iRow, 5).Value = Me.Q1.Value
ws.Cells(iRow, 6).Value = Me.Q2.Value
ws.Cells(iRow, 7).Value = Me.Q3.Value

'clear the data
Me.Q1.Value = "True"
Me.Q2.Value = "True"
Me.Q3.Value = "True"

End Sub

"Howard31" wrote:

Hi giardina,

Try using another Variable, as follows:

Sub GetCheckBoxValue()
Dim NumerValue As Integer

If CheckBox1.Value = True Then
NumberValue = 1
Else
NumberValue = 0
End If

End Sub

Hope this helps,

--
A. Ch. Eirinberg


"giardina" wrote:

I'm sure my missing something, but I created a Form which adds records to a
worksheet. I have a series of check boxes in the form. When it records the
record it uses True or False. I'm trying to have it set as a numeric 1 or 0.
I've sreached around a bit but haven't found the property setting to
accomplish this. Needless to say my code writing skills are virtually
non-existent so.... any help would be appreciated. Thanks.


--

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
Increase size of a Forms Check Box (click on to enter check mark) 718Satoshi Excel Discussion (Misc queries) 0 August 17th 07 01:52 AM
Hiding a check box from forms TDC Excel Discussion (Misc queries) 1 February 24th 07 01:40 PM
Forms/ Check Box Gary Excel Discussion (Misc queries) 1 September 13th 06 09:44 PM
Check box in Forms Toolbar abfabrob Excel Discussion (Misc queries) 1 April 11th 05 03:31 PM
check off, look up forms - VERY confused Abi Excel Discussion (Misc queries) 1 January 8th 05 01:47 AM


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