#1   Report Post  
Posted to microsoft.public.excel.programming
Zak Zak is offline
external usenet poster
 
Posts: 144
Default Check Box

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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default 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
  #3   Report Post  
Posted to microsoft.public.excel.programming
Zak Zak is offline
external usenet poster
 
Posts: 144
Default Check Box

Hi

Thanks for getting back to me, when i try your code i get an error (yellow
highlight) on the .Range("A" & R).Value = Me.OwnerN.Text line.

Any ideas??

Thanks again.



"Dave Peterson" wrote:

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

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

I changed BookApp to Me. Because I thought you were populating the cell with
the value from the control on that same userform as the commandbutton.

If that's not true, then change it back to BookApp.

Maybe add a line to help you debug:

msgbox R & vblf & me.ownern.text
or
msgbox R & vblf & bookapp.ownern.text

to make sure that the variables are what you expected.


zak wrote:

Hi

Thanks for getting back to me, when i try your code i get an error (yellow
highlight) on the .Range("A" & R).Value = Me.OwnerN.Text line.

Any ideas??

Thanks again.

"Dave Peterson" wrote:

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


--

Dave Peterson
  #5   Report Post  
Posted to microsoft.public.excel.programming
Zak Zak is offline
external usenet poster
 
Posts: 144
Default Check Box

Hi Dave

Your correct, I am populating the cell with the value from the control box
which is on the same userform.

Shall I still try the msgBox code below?


"Dave Peterson" wrote:

I changed BookApp to Me. Because I thought you were populating the cell with
the value from the control on that same userform as the commandbutton.

If that's not true, then change it back to BookApp.

Maybe add a line to help you debug:

msgbox R & vblf & me.ownern.text
or
msgbox R & vblf & bookapp.ownern.text

to make sure that the variables are what you expected.


zak wrote:

Hi

Thanks for getting back to me, when i try your code i get an error (yellow
highlight) on the .Range("A" & R).Value = Me.OwnerN.Text line.

Any ideas??

Thanks again.

"Dave Peterson" wrote:

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


--

Dave Peterson



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

Yes.

And make sure that Appointments is not protected.

zak wrote:

Hi Dave

Your correct, I am populating the cell with the value from the control box
which is on the same userform.

Shall I still try the msgBox code below?

"Dave Peterson" wrote:

I changed BookApp to Me. Because I thought you were populating the cell with
the value from the control on that same userform as the commandbutton.

If that's not true, then change it back to BookApp.

Maybe add a line to help you debug:

msgbox R & vblf & me.ownern.text
or
msgbox R & vblf & bookapp.ownern.text

to make sure that the variables are what you expected.


zak wrote:

Hi

Thanks for getting back to me, when i try your code i get an error (yellow
highlight) on the .Range("A" & R).Value = Me.OwnerN.Text line.

Any ideas??

Thanks again.

"Dave Peterson" wrote:

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


--

Dave Peterson


--

Dave Peterson
  #7   Report Post  
Posted to microsoft.public.excel.programming
Zak Zak is offline
external usenet poster
 
Posts: 144
Default Check Box

Hi Dave

Where in the code shall i put - msgbox R & vblf & bookapp.ownern.text?

Thanks


"Dave Peterson" wrote:

Yes.

And make sure that Appointments is not protected.

zak wrote:

Hi Dave

Your correct, I am populating the cell with the value from the control box
which is on the same userform.

Shall I still try the msgBox code below?

"Dave Peterson" wrote:

I changed BookApp to Me. Because I thought you were populating the cell with
the value from the control on that same userform as the commandbutton.

If that's not true, then change it back to BookApp.

Maybe add a line to help you debug:

msgbox R & vblf & me.ownern.text
or
msgbox R & vblf & bookapp.ownern.text

to make sure that the variables are what you expected.


zak wrote:

Hi

Thanks for getting back to me, when i try your code i get an error (yellow
highlight) on the .Range("A" & R).Value = Me.OwnerN.Text line.

Any ideas??

Thanks again.

"Dave Peterson" wrote:

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


--

Dave Peterson


--

Dave Peterson

  #8   Report Post  
Posted to microsoft.public.excel.programming
Zak Zak is offline
external usenet poster
 
Posts: 144
Default Check Box

Dave

sorry to bother you again, but its not working again, but i know what the
problem is now.

It adds it the first time, but if i opened the form again to add another
appointment it falls over and does the yellow highlight thing, so its not
putting the info into the next row. i.e. it puts it into row A3, but falls
over and doesnt put it onto row B3 and so on

Is there anyway I could overcome this problem??

Thank you.



"Dave Peterson" wrote:

Yes.

And make sure that Appointments is not protected.

zak wrote:

Hi Dave

Your correct, I am populating the cell with the value from the control box
which is on the same userform.

Shall I still try the msgBox code below?

"Dave Peterson" wrote:

I changed BookApp to Me. Because I thought you were populating the cell with
the value from the control on that same userform as the commandbutton.

If that's not true, then change it back to BookApp.

Maybe add a line to help you debug:

msgbox R & vblf & me.ownern.text
or
msgbox R & vblf & bookapp.ownern.text

to make sure that the variables are what you expected.


zak wrote:

Hi

Thanks for getting back to me, when i try your code i get an error (yellow
highlight) on the .Range("A" & R).Value = Me.OwnerN.Text line.

Any ideas??

Thanks again.

"Dave Peterson" wrote:

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


--

Dave Peterson


--

Dave Peterson

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

This portion of your code:

If Sheets("Appointments").Range("A3").Value = "" _
Then
R = 3
Else
R = Sheets("Appointments").Range("A3").End(xlDown).Row + 1
End If


Should be figuring out what row gets the data. You still have that portion in
your code, right?

If you don't, then add it back.

If you do, then add another line right after that portion of code:

If Sheets("Appointments").Range("A3").Value = "" _
Then
R = 3
Else
R = Sheets("Appointments").Range("A3").End(xlDown).Row + 1
End If


msgbox R & " - This row gets the data!"

.... rest of your code.

If that doesn't work, you'll want to post the code you're using.

zak wrote:

Dave

sorry to bother you again, but its not working again, but i know what the
problem is now.

It adds it the first time, but if i opened the form again to add another
appointment it falls over and does the yellow highlight thing, so its not
putting the info into the next row. i.e. it puts it into row A3, but falls
over and doesnt put it onto row B3 and so on

Is there anyway I could overcome this problem??

Thank you.

"Dave Peterson" wrote:

Yes.

And make sure that Appointments is not protected.

zak wrote:

Hi Dave

Your correct, I am populating the cell with the value from the control box
which is on the same userform.

Shall I still try the msgBox code below?

"Dave Peterson" wrote:

I changed BookApp to Me. Because I thought you were populating the cell with
the value from the control on that same userform as the commandbutton.

If that's not true, then change it back to BookApp.

Maybe add a line to help you debug:

msgbox R & vblf & me.ownern.text
or
msgbox R & vblf & bookapp.ownern.text

to make sure that the variables are what you expected.


zak wrote:

Hi

Thanks for getting back to me, when i try your code i get an error (yellow
highlight) on the .Range("A" & R).Value = Me.OwnerN.Text line.

Any ideas??

Thanks again.

"Dave Peterson" wrote:

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


--

Dave Peterson


--

Dave Peterson


--

Dave Peterson
  #10   Report Post  
Posted to microsoft.public.excel.programming
Zak Zak is offline
external usenet poster
 
Posts: 144
Default Check Box

Thanks Dave

I have tried the message code and figured out what the problem was and now
it works.

Thanks for all of your help with this.



"Dave Peterson" wrote:

This portion of your code:

If Sheets("Appointments").Range("A3").Value = "" _
Then
R = 3
Else
R = Sheets("Appointments").Range("A3").End(xlDown).Row + 1
End If


Should be figuring out what row gets the data. You still have that portion in
your code, right?

If you don't, then add it back.

If you do, then add another line right after that portion of code:

If Sheets("Appointments").Range("A3").Value = "" _
Then
R = 3
Else
R = Sheets("Appointments").Range("A3").End(xlDown).Row + 1
End If


msgbox R & " - This row gets the data!"

.... rest of your code.

If that doesn't work, you'll want to post the code you're using.

zak wrote:

Dave

sorry to bother you again, but its not working again, but i know what the
problem is now.

It adds it the first time, but if i opened the form again to add another
appointment it falls over and does the yellow highlight thing, so its not
putting the info into the next row. i.e. it puts it into row A3, but falls
over and doesnt put it onto row B3 and so on

Is there anyway I could overcome this problem??

Thank you.

"Dave Peterson" wrote:

Yes.

And make sure that Appointments is not protected.

zak wrote:

Hi Dave

Your correct, I am populating the cell with the value from the control box
which is on the same userform.

Shall I still try the msgBox code below?

"Dave Peterson" wrote:

I changed BookApp to Me. Because I thought you were populating the cell with
the value from the control on that same userform as the commandbutton.

If that's not true, then change it back to BookApp.

Maybe add a line to help you debug:

msgbox R & vblf & me.ownern.text
or
msgbox R & vblf & bookapp.ownern.text

to make sure that the variables are what you expected.


zak wrote:

Hi

Thanks for getting back to me, when i try your code i get an error (yellow
highlight) on the .Range("A" & R).Value = Me.OwnerN.Text line.

Any ideas??

Thanks again.

"Dave Peterson" wrote:

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


--

Dave Peterson


--

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
Copy and move check box (check boxes) with new cell link? Marty Excel Worksheet Functions 1 January 20th 10 07:43 PM
Loop through column(s) to check values, perform action based on check ward376 Excel Programming 4 November 6th 07 03:21 PM
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
Check if Conditional Format is True or False / Check cell Color Kevin McCartney Excel Worksheet Functions 5 June 29th 07 11:12 AM
Enable check box in protected sheet + group check boxes Dexxterr Excel Discussion (Misc queries) 4 August 2nd 06 12:00 PM


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