MLI
12-06-2008, 10:41 PM
Hi All
Hope somebody can help me. I would like to copy a Option Button's Caption into a Excel Database cell when selected. I want to populate the cells in Row10 by just selecting one of 4 Option Buttons (Button1 = "Now", Button2 = "Weekly", Button3 = "2 Weekly" & Button4 = "Monthly")
Below is part of the code I've used to initialize the form and I don't know if the "ws.Cells(iRow, 10).Value = Me.OptionButton1.Value" is correct and also what the "Private Sub OptionButton1_Click()" should look like:oNormal, li.MsoNormal, div.MsoNormal {mso-style-parent:""; margin:0cm; margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:12.0pt; font-family:Arial; mso-fareast-font-family:"Times New Roman"; mso-bidi-font-family:"Times New Roman";} @page Section1 {size:612.0pt 792.0pt; margin:72.0pt 90.0pt 72.0pt 90.0pt; mso-header-margin:36.0pt; mso-footer-margin:36.0pt; mso-paper-source:0;} div.Section1 {page:Section1;} -->
'copy the data to the database
ws.Cells(iRow, 1).Value = Me.txtAssessor.Value
ws.Cells(iRow, 2).Value = Me.txtDate.Value
ws.Cells(iRow, 3).Value = Me.txtJSATitle.Value
ws.Cells(iRow, 4).Value = Me.txtWorkCentre.Value
ws.Cells(iRow, 5).Value = Me.txtPlanNo.Value
ws.Cells(iRow, 6).Value = Me.txtJSARiskScore.Value
ws.Cells(iRow, 7).Value = Me.txtKeyStep.Value
ws.Cells(iRow, 8).Value = Me.txtCorrAct.Value
ws.Cells(iRow, 9).Value = Me.txtRiskScore.Value
ws.Cells(iRow, 10).Value = Me.OptionButton1.Value
'clear the data
Me.txtAssessor.Value = ""
Me.txtDate.Value = ""
Me.txtJSATitle.Value = ""
Me.txtWorkCentre.Value = ""
Me.txtPlanNo.Value = ""
Me.txtJSARiskScore.Value = ""
Me.txtKeyStep.Value = ""
Me.txtCorrAct.Value = ""
Me.txtRiskScore.Value = ""
Me.OptionButton1.Value = ""
Me.txtAssessor.SetFocus
Thanks
Hope somebody can help me. I would like to copy a Option Button's Caption into a Excel Database cell when selected. I want to populate the cells in Row10 by just selecting one of 4 Option Buttons (Button1 = "Now", Button2 = "Weekly", Button3 = "2 Weekly" & Button4 = "Monthly")
Below is part of the code I've used to initialize the form and I don't know if the "ws.Cells(iRow, 10).Value = Me.OptionButton1.Value" is correct and also what the "Private Sub OptionButton1_Click()" should look like:oNormal, li.MsoNormal, div.MsoNormal {mso-style-parent:""; margin:0cm; margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:12.0pt; font-family:Arial; mso-fareast-font-family:"Times New Roman"; mso-bidi-font-family:"Times New Roman";} @page Section1 {size:612.0pt 792.0pt; margin:72.0pt 90.0pt 72.0pt 90.0pt; mso-header-margin:36.0pt; mso-footer-margin:36.0pt; mso-paper-source:0;} div.Section1 {page:Section1;} -->
'copy the data to the database
ws.Cells(iRow, 1).Value = Me.txtAssessor.Value
ws.Cells(iRow, 2).Value = Me.txtDate.Value
ws.Cells(iRow, 3).Value = Me.txtJSATitle.Value
ws.Cells(iRow, 4).Value = Me.txtWorkCentre.Value
ws.Cells(iRow, 5).Value = Me.txtPlanNo.Value
ws.Cells(iRow, 6).Value = Me.txtJSARiskScore.Value
ws.Cells(iRow, 7).Value = Me.txtKeyStep.Value
ws.Cells(iRow, 8).Value = Me.txtCorrAct.Value
ws.Cells(iRow, 9).Value = Me.txtRiskScore.Value
ws.Cells(iRow, 10).Value = Me.OptionButton1.Value
'clear the data
Me.txtAssessor.Value = ""
Me.txtDate.Value = ""
Me.txtJSATitle.Value = ""
Me.txtWorkCentre.Value = ""
Me.txtPlanNo.Value = ""
Me.txtJSARiskScore.Value = ""
Me.txtKeyStep.Value = ""
Me.txtCorrAct.Value = ""
Me.txtRiskScore.Value = ""
Me.OptionButton1.Value = ""
Me.txtAssessor.SetFocus
Thanks