Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() Hi all I am creating a user form to add data to a spreadsheet. I have set up text boxes to add this data and then move on to the next line ready for new data (This works). I also need to allow this to happen when a user selects an option box (Male or Female). I have create a frame (Frame1) and placed two option boxes within this frame, one called optMale and the other optFemale, these have also been grouped. This is the code I currently have on my command button, which allows me to add the data to the spreadsheet but I need to add the gender for each row from these option boxes. Any help would be most appreciated. Private Sub cmdAdd_Click() Dim iRow As Long Dim ws As Worksheet Set ws = Worksheets("PartsData") 'find first empty row in database iRow = ws.Cells(Rows.Count, 1) _ End(xlUp).Offset(1, 0).Row 'copy the data to the Spreadsheet ws.Cells(iRow, 1).Value = Me.houseNo.Value ws.Cells(iRow, 2).Value = Me.streetName.Value ws.Cells(iRow, 3).Value = Me.Town.Value ws.Cells(iRow, 4).Value = Me.postCode.Value 'clear the data Me.houseNo.Value = "" Me.streetName.Value = "" Me.Town.Value = "" Me.postCode.Value = "" End Sub -- levtweeney ------------------------------------------------------------------------ levtweeney's Profile: http://www.thecodecage.com/forumz/member.php?userid=478 View this thread: http://www.thecodecage.com/forumz/sh...d.php?t=113703 |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
disable option button on user form | Excel Programming | |||
option button (Form) | Excel Programming | |||
Controlling an Option Group in a User Form | Excel Discussion (Misc queries) | |||
User Form Option & Command Buttons | Excel Programming | |||
Difficulties in VBA ( User form and option button) | Excel Programming |