Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 144
Default Adding UserForm Data to Worksheet

I hope someone can please help me with this. I have a userform with a
multiplage that consists of 4 pages. My controls consists mainly of text
boxes and Frames with checkboxes. I need to know how to add the checkboxes
to the worksheet. below is a sample of the code I have to add text boxes but
I do not know how to add check boxes. Some of the frames contain a couple of
check boxes to some frames containing over ten check boxes. Some of the
frames you just choose one of the check boxes and in some instances some of
the frames the user may need to check off several check boxes. How do I
incorporate this into my code below? If you can provide a sample that would
be very helpful. Thank you in advance for any help you can provide. Thank
you.

Private Sub CommandButton7_Click()
Dim iRow As Long
Dim ws As Worksheet
Set ws = Worksheets("ReqInfo")

'find first empty row in database
iRow = ws.Cells(Rows.Count, 1) _
.End(xlUp).Offset(1, 0).Row

'copy the data to the database
ws.Cells(iRow, 1).Value = Me.txtReqDate.Value
ws.Cells(iRow, 2).Value = Me.txtFNM.Value
ws.Cells(iRow, 3).Value = Me.txtLNM.Value
ws.Cells(iRow, 4).Value = Me.txtemail.Value


'clear the data
Me.txtReqDate.Value = ""
Me.txtFNM.Value = ""
Me.txtLNM.Value = ""
Me.txtemail.Value = ""


Me.txtReqDate.SetFocus

End Sub

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Adding UserForm Data to Worksheet

Each checkbox is independent of the other checkboxes?

If that's true, I'd just use a separate field for each of the checkboxes:

ws.Cells(iRow, 5).Value = Me.checkbox1.Value
ws.Cells(iRow, 6).Value = Me.checkbox2.Value
ws.Cells(iRow, 7).Value = Me.checkbox3.Value

(change the columns and the names of the checkboxes to what you need)

TotallyConfused wrote:

I hope someone can please help me with this. I have a userform with a
multiplage that consists of 4 pages. My controls consists mainly of text
boxes and Frames with checkboxes. I need to know how to add the checkboxes
to the worksheet. below is a sample of the code I have to add text boxes but
I do not know how to add check boxes. Some of the frames contain a couple of
check boxes to some frames containing over ten check boxes. Some of the
frames you just choose one of the check boxes and in some instances some of
the frames the user may need to check off several check boxes. How do I
incorporate this into my code below? If you can provide a sample that would
be very helpful. Thank you in advance for any help you can provide. Thank
you.

Private Sub CommandButton7_Click()
Dim iRow As Long
Dim ws As Worksheet
Set ws = Worksheets("ReqInfo")

'find first empty row in database
iRow = ws.Cells(Rows.Count, 1) _
.End(xlUp).Offset(1, 0).Row

'copy the data to the database
ws.Cells(iRow, 1).Value = Me.txtReqDate.Value
ws.Cells(iRow, 2).Value = Me.txtFNM.Value
ws.Cells(iRow, 3).Value = Me.txtLNM.Value
ws.Cells(iRow, 4).Value = Me.txtemail.Value

'clear the data
Me.txtReqDate.Value = ""
Me.txtFNM.Value = ""
Me.txtLNM.Value = ""
Me.txtemail.Value = ""

Me.txtReqDate.SetFocus

End Sub


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 144
Default Adding UserForm Data to Worksheet

Thank you for responding. Most of the checkboxes in the frames are
independent. However, I do have some that are where I only need to record
one answer out of three. Can you please provide a sample for that? Thank
you.

"Dave Peterson" wrote:

Each checkbox is independent of the other checkboxes?

If that's true, I'd just use a separate field for each of the checkboxes:

ws.Cells(iRow, 5).Value = Me.checkbox1.Value
ws.Cells(iRow, 6).Value = Me.checkbox2.Value
ws.Cells(iRow, 7).Value = Me.checkbox3.Value

(change the columns and the names of the checkboxes to what you need)

TotallyConfused wrote:

I hope someone can please help me with this. I have a userform with a
multiplage that consists of 4 pages. My controls consists mainly of text
boxes and Frames with checkboxes. I need to know how to add the checkboxes
to the worksheet. below is a sample of the code I have to add text boxes but
I do not know how to add check boxes. Some of the frames contain a couple of
check boxes to some frames containing over ten check boxes. Some of the
frames you just choose one of the check boxes and in some instances some of
the frames the user may need to check off several check boxes. How do I
incorporate this into my code below? If you can provide a sample that would
be very helpful. Thank you in advance for any help you can provide. Thank
you.

Private Sub CommandButton7_Click()
Dim iRow As Long
Dim ws As Worksheet
Set ws = Worksheets("ReqInfo")

'find first empty row in database
iRow = ws.Cells(Rows.Count, 1) _
.End(xlUp).Offset(1, 0).Row

'copy the data to the database
ws.Cells(iRow, 1).Value = Me.txtReqDate.Value
ws.Cells(iRow, 2).Value = Me.txtFNM.Value
ws.Cells(iRow, 3).Value = Me.txtLNM.Value
ws.Cells(iRow, 4).Value = Me.txtemail.Value

'clear the data
Me.txtReqDate.Value = ""
Me.txtFNM.Value = ""
Me.txtLNM.Value = ""
Me.txtemail.Value = ""

Me.txtReqDate.SetFocus

End Sub


--

Dave Peterson

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Adding UserForm Data to Worksheet

if me.checkbox1.value = true then
ws.cells(irow,99).value = 1
elseif me.checkbox2.value = true then
ws.cells(irow,99).value = 2
elseif me.checkbox3.value = true then
ws.cells(irow,99).value = 3
else
ws.cells(irow,99).value = 0
end if

I would think that if you only could check one box out of 3, then using
optionbuttons would be more natural -- and easier to implement.

TotallyConfused wrote:

Thank you for responding. Most of the checkboxes in the frames are
independent. However, I do have some that are where I only need to record
one answer out of three. Can you please provide a sample for that? Thank
you.

"Dave Peterson" wrote:

Each checkbox is independent of the other checkboxes?

If that's true, I'd just use a separate field for each of the checkboxes:

ws.Cells(iRow, 5).Value = Me.checkbox1.Value
ws.Cells(iRow, 6).Value = Me.checkbox2.Value
ws.Cells(iRow, 7).Value = Me.checkbox3.Value

(change the columns and the names of the checkboxes to what you need)

TotallyConfused wrote:

I hope someone can please help me with this. I have a userform with a
multiplage that consists of 4 pages. My controls consists mainly of text
boxes and Frames with checkboxes. I need to know how to add the checkboxes
to the worksheet. below is a sample of the code I have to add text boxes but
I do not know how to add check boxes. Some of the frames contain a couple of
check boxes to some frames containing over ten check boxes. Some of the
frames you just choose one of the check boxes and in some instances some of
the frames the user may need to check off several check boxes. How do I
incorporate this into my code below? If you can provide a sample that would
be very helpful. Thank you in advance for any help you can provide. Thank
you.

Private Sub CommandButton7_Click()
Dim iRow As Long
Dim ws As Worksheet
Set ws = Worksheets("ReqInfo")

'find first empty row in database
iRow = ws.Cells(Rows.Count, 1) _
.End(xlUp).Offset(1, 0).Row

'copy the data to the database
ws.Cells(iRow, 1).Value = Me.txtReqDate.Value
ws.Cells(iRow, 2).Value = Me.txtFNM.Value
ws.Cells(iRow, 3).Value = Me.txtLNM.Value
ws.Cells(iRow, 4).Value = Me.txtemail.Value

'clear the data
Me.txtReqDate.Value = ""
Me.txtFNM.Value = ""
Me.txtLNM.Value = ""
Me.txtemail.Value = ""

Me.txtReqDate.SetFocus

End Sub


--

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
UserForm Data to Worksheet maximillan Excel Programming 6 August 29th 06 10:35 AM
Adding data to a worksheet from a UserForm Kezza Excel Programming 1 August 22nd 06 12:50 PM
adding a worksheet causes main userform to corrupt Magius00 Excel Programming 4 October 26th 05 09:02 AM
Data from userform to worksheet koala[_15_] Excel Programming 0 October 9th 04 08:34 AM
Data from userform to worksheet koala[_13_] Excel Programming 0 October 9th 04 01:20 AM


All times are GMT +1. The time now is 04:59 AM.

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"