LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Option Button in User Form


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
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
disable option button on user form JH Excel Programming 4 May 7th 09 09:07 PM
option button (Form) George Excel Programming 2 March 8th 07 03:01 AM
Controlling an Option Group in a User Form SaeOngJeeMa Excel Discussion (Misc queries) 0 November 29th 06 08:17 AM
User Form Option & Command Buttons Information Hog[_2_] Excel Programming 1 August 19th 05 10:00 PM
Difficulties in VBA ( User form and option button) paradise Excel Programming 2 October 28th 03 01:11 PM


All times are GMT +1. The time now is 09:46 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"