Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Combobox userform help please
I have a userform for entering and editing data that has a combox on it
so the user can jump to a specific record to edit. I also have a "next" button to go to the next record and a "previous" button to back a record. If I leave the combobox blank in it's inital state I can change data in the userform, hit the "next button" and the changes show up correctly to the worksheet. However, once I use the combobox to jump to a record and try make a change and hit the next button, instead of the change showing up correctly on the worksheet, my record gets overwritten and it messes up my worksheet. Here is my code if anyone can advise on how to correct the above problem. Private Sub cmdNext_Click() ' Save form contents before changing rows: SaveRow ' Increment row number: lCurrentRow = lCurrentRow + 1 ' Show contents of row in the form: LoadRow End Sub Private Sub ComboBox1_Change() Set rng = Range(ComboBox1.RowSource) txtReqNum.Text = rng(ComboBox1.ListIndex + 1)(1, 1) txtDateOpen.Text = rng(ComboBox1.ListIndex + 1)(1, 2) txtType.Text = rng(ComboBox1.ListIndex + 1)(1, 4) txtPriority.Text = rng(ComboBox1.ListIndex + 1)(1, 5) txtTitle.Text = rng(ComboBox1.ListIndex + 1)(1, 6) txtGrd.Text = rng(ComboBox1.ListIndex + 1)(1, 7) txtRange.Text = rng(ComboBox1.ListIndex + 1)(1, 8) txtExpected.Text = rng(ComboBox1.ListIndex + 1)(1, 9) txtNR.Text = rng(ComboBox1.ListIndex + 1)(1, 11) txtManager.Text = rng(ComboBox1.ListIndex + 1)(1, 12) txtRecr.Text = rng(ComboBox1.ListIndex + 1)(1, 13) txtStatus.Text = rng(ComboBox1.ListIndex + 1)(1, 14) txtCandidate.Text = rng(ComboBox1.ListIndex + 1)(1, 15) End Sub Private Sub UserForm_Activate() ' Read initial values from Row 1: lCurrentRow = Range("My_Range").Cells(4, 1).Row LoadRow ComboBox1.RowSource = Range(Range("My_Range").Offset(4), _ Range("My_Range").Offset(4).End(xlDown)).Address End Sub |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Combobox userform help please
|
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Value From ComboBox On UserForm | Excel Discussion (Misc queries) | |||
ComboBox on a UserForm | Excel Worksheet Functions | |||
combobox and userform help! | Excel Programming | |||
ComboBox on UserForm | Excel Programming | |||
ComboBox on UserForm | Excel Programming |