Macro to save radiobutton and checkbox value in another workbook

Kaddy

New Member
Joined
Oct 12, 2013
Messages
2
Hello Excel gurus,
I have created a form using form controls from the Developer tab in excel. The form contains cells, checkbox and radiobutton. I have provided a Submit button which has a macro assigned to it.

When the user clicks on submit, i want to save the user values into another workbook. I have written the below macro and the user input from different cells is sucessfully saved. But, i am not aware of how to read the radiobutton and checkbox value and save it in the workbook.

Sub Submit()
Dim wb As Workbook, NR As Long
Set wb = Workbooks.Open("Final.xls")
NR = Sheets("Sheet1").Range("A" & Rows.Count).End(xlUp).Row + 1
With ThisWorkbook.Sheets("Sheet1")
wb.Sheets("Sheet1").Range("A" & NR).Value = .Range("A3:D3").Value
wb.Sheets("Sheet1").Range("B" & NR).Value = .Range("A4:D4").Value
wb.Sheets("Sheet1").Range("C" & NR).Value = .Range("A5:D5").Value
wb.Sheets("Sheet1").Range("D" & NR).Value = .Range("F3:G3").Value
wb.Sheets("Sheet1").Range("E" & NR).Value = .Range("F4:G4").Value
wb.Sheets("Sheet1").Range("F" & NR).Value = .Range("F5:G5").Value
wb.Sheets("Sheet1").Range("G" & NR).Value = .Range("H3").Value
wb.Sheets("Sheet1").Range("H" & NR).Value = .Range("A8:H8").Value
End With
wb.Close SaveChanges:=True
End Sub

Please help me in getting the user values for radiobutton and checkbox.

Thanks,
Kaddy.
 

Excel Facts

How to show all formulas in Excel?
Press Ctrl+` to show all formulas. Press it again to toggle back to numbers. The grave accent is often under the tilde on US keyboards.
Im not sure if this is the only way, but the way i do it is...link the checkbox to a cell on your worksheet. Right-click on your checkbox in the design view, select Properties. Enter in a cell address in the Linked Cell field. Now you will notice that when you place a check mark in the check box, the cell that you linked will display "TRUE" and when you remove the checkmark, it will display "FALSE". In your VBA code, just copy that value into the other sheet.
 
Upvote 0
Thanks Shadow. But, the value "True" or "False" are also displayed to the user. It makes it hard to read the checkbox text in this case? How can i hide the "True" "False" values from the user?
 
Upvote 0

Forum statistics

Threads
1,223,164
Messages
6,170,444
Members
452,326
Latest member
johnshaji

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top