keithkemble
Board Regular
- Joined
- Feb 15, 2002
- Messages
- 160
I am trying to put the value of the checkbox (1 if true, 0 if false) into a cell in the sheet.
The first sub does yield the correct values while running, but when I get to the writedata sub it has lost its value despite being Publi.
Can any one advise how to hold on to the value. All subs are in the same Userform module.
The name of the checkbox is checkbox1
Public Sub checkBox1_Click()
Dim Chk1 As Variant
If CheckBox1.Value = True Then
Chk1 = 1
Else: Chk1 = 0
End If
End Sub'
Sub WriteData(dbRow As Integer)
Dim i As Integer, fieldValue As Variant
' Enter data in fields
'
For i = 1 To totalFields
fieldValue = textBoxes(textboxNames(i - 1)).Text
Cells(dbRow, i).Offset(0, 4).Value = fieldValue
Next 'i
Cells(dbRow, i).Offset(0, 0).Value = Chk1
Cells(dbRow, i).Offset(0, 1).Value = Chk2
'
' Select first cell in record
'
' Cells(dbRow, 1).Select
End Sub
Thanks
The first sub does yield the correct values while running, but when I get to the writedata sub it has lost its value despite being Publi.
Can any one advise how to hold on to the value. All subs are in the same Userform module.
The name of the checkbox is checkbox1
Public Sub checkBox1_Click()
Dim Chk1 As Variant
If CheckBox1.Value = True Then
Chk1 = 1
Else: Chk1 = 0
End If
End Sub'
Sub WriteData(dbRow As Integer)
Dim i As Integer, fieldValue As Variant
' Enter data in fields
'
For i = 1 To totalFields
fieldValue = textBoxes(textboxNames(i - 1)).Text
Cells(dbRow, i).Offset(0, 4).Value = fieldValue
Next 'i
Cells(dbRow, i).Offset(0, 0).Value = Chk1
Cells(dbRow, i).Offset(0, 1).Value = Chk2
'
' Select first cell in record
'
' Cells(dbRow, 1).Select
End Sub
Thanks