I currently have a VB form which has a load of text boxes on which a user can enter the relevant data, then when they click on the Next button (See code below) all of the data they have entered is exported into the relevant cells in a certain Excel sheet and it works fine.
I have now added two OptionButtons ('PM 1' & 'PM 2') which one has to be selected before proceeding but i want the selected button to export its value (1 & 2 respectively) to be exported into Excel like the text boxes, can this be done?
Any help would be appreciated.
############################
Private Sub cmdNext_Click()
Dim RetVal
Dim oXL As Excel.Application
Set oXL = Excel.Application
Excel.Application.Visible = True
oXL.Workbooks.Open ("C:\Software Development\adc1632.xls"
With oXL
.Visible = True
.Range("C3"
.Value = txtProject.Text
.Range("C4"
.Value = txtNumber.Text
.Range("C5"
.Value = txtJob.Text
.Range("C6"
.Value = txtClient.Text
.Range("C7"
.Value = txtDate.Text
.Range("C8"
.Value = txtTime.Text
.Range("C9"
.Value = txtBorehole.Text
.Range("C10"
.Value = txtTestNo.Text
.Range("C11"
.Value = txtOperator.Text
.Range("C12"
.Value = txtDepth.Text
.Range("C13"
.Value = txtMethod.Text
.Range("C14"
.Value = txtNotes.Text
End With
Unload Me
Set oXL = Nothing
End Sub
I have now added two OptionButtons ('PM 1' & 'PM 2') which one has to be selected before proceeding but i want the selected button to export its value (1 & 2 respectively) to be exported into Excel like the text boxes, can this be done?
Any help would be appreciated.
############################
Private Sub cmdNext_Click()
Dim RetVal
Dim oXL As Excel.Application
Set oXL = Excel.Application
Excel.Application.Visible = True
oXL.Workbooks.Open ("C:\Software Development\adc1632.xls"
With oXL
.Visible = True
.Range("C3"
.Range("C4"
.Range("C5"
.Range("C6"
.Range("C7"
.Range("C8"
.Range("C9"
.Range("C10"
.Range("C11"
.Range("C12"
.Range("C13"
.Range("C14"
End With
Unload Me
Set oXL = Nothing
End Sub