Check Box
Maybe...
Private Sub SendAppReq_Click()
If Sheets("Appointments").Range("A3").Value = "" _
Then
R = 3
Else
R = Sheets("Appointments").Range("A3").End(xlDown).Row + 1
End If
With Sheets("Appointments")
.Range("A" & R).Value = Me.OwnerN.Text
.Range("A" & R).Value = Me.OwnerN.Text
.Range("B" & R).Value = Me.AppDur.Text
.Range("C" & R).Value = Me.LaptopDetails.Text
.Range("D" & R).Value = Me.PropDate.Text
.Range("E" & R).Value = Me.PropTime.Text
.Range("F" & R).Value = Me.AppDur.Text
if me.checkbox1.value = true then
.Range("G" & R).Value = "yes"
else
.Range("G" & R).Value = "" '"no" '???
end if
End With
Unload Me
End Sub
Me refers to the object that owns the code--in this case, I'm guessing it's the
BookApp userform.
zak wrote:
Hi
Please see my code below. I would like to know if anyone can help me to add
a condition in the code.
The condition is basically that I have a check box on a form, and if the box
is check (with a tick obviously) then I want the word "Yes" to be cell G for
the corresponding row. Is there any way I can add some code to the below to
do this?
Private Sub SendAppReq_Click()
If Sheets("Appointments").Range("A3").Value = "" _
Then
R = 3
Else
R = Sheets("Appointments").Range("A3").End(xlDown).Row + 1
End If
With Sheets("Appointments")
.Range("A" & R).Value = BookApp.OwnerN.Text
.Range("B" & R).Value = BookApp.AppDur.Text
.Range("C" & R).Value = BookApp.LaptopDetails.Text
.Range("D" & R).Value = BookApp.PropDate.Text
.Range("E" & R).Value = BookApp.PropTime.Text
.Range("F" & R).Value = BookApp.AppDur.Text
Unload BookApp
BookApp.Hide
End With
Unload BookApp
End Sub
Thanking you in advance
--
Dave Peterson
|