Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Adding to excel user form combobox
hello - I have a combobox that has the source from D2:D12. What I want
to acomplish is, if a user enters in something that is not found in the dropdown, or D2:D12 that a yes no msg pops asking if they want to add it, find D13 and add the text there so it's available later...make sense? |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Adding to excel user form combobox
Hi!
I hope that next code help you. Private Sub ComboBox1_GotFocus() Dim DynamicArea As Range Dim NextRow As Long Dim FirstRow As Long With ThisWorkbook.Sheets(1) NextRow = Cells(Rows.Count, "D").End(xlUp).Row .Names.Add Name:="DynamicArea", RefersTo:= _ .Range("D2" & ":D" & NextRow & "") Set DynamicArea = .Range("DynamicArea") End With ComboBox1.ListFillRange = "DynamicArea" End Sub Regards, Kari J Keinonen |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Adding to excel user form combobox
Private Sub ComboBox1_AfterUpdate()
Dim iRow As Long Dim iRtn As Integer iRtn = MsgBox("Keep this?", vbYesNo) If iRtn = 6 Then iRow = Sheets("Sheet1").Range("D65536").End(xlUp).Row Sheets("Sheet1").Range("D" & iRow + 1) = ComboBox1.Value UserForm_Activate End If End Sub Private Sub UserForm_Activate() Dim rng As Range Dim iRow As Long iRow = Sheets("Sheet1").Range("D65536").End(xlUp).Row Set rng = Sheets("Sheet1").Range("D2:D" & iRow) ComboBox1.RowSource = rng.Worksheet.Name & "!" & rng.Address End Sub Hth, Merjet |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Adding to excel user form combobox
Thanks...Merjet, worked like a charm....
On Jan 25, 10:26 pm, "merjet" wrote: Private Sub ComboBox1_AfterUpdate() Dim iRow As Long Dim iRtn As Integer iRtn = MsgBox("Keep this?", vbYesNo) If iRtn = 6 Then iRow = Sheets("Sheet1").Range("D65536").End(xlUp).Row Sheets("Sheet1").Range("D" & iRow + 1) = ComboBox1.Value UserForm_Activate End If End Sub Private Sub UserForm_Activate() Dim rng As Range Dim iRow As Long iRow = Sheets("Sheet1").Range("D65536").End(xlUp).Row Set rng = Sheets("Sheet1").Range("D2:D" & iRow) ComboBox1.RowSource = rng.Worksheet.Name & "!" & rng.Address End Sub Hth, Merjet |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Could not set the Text property of a ComboBox on User Form. | Excel Programming | |||
Could not set the Text property of a ComboBox on User Form. | Excel Programming | |||
Adding WorksheetData to a ComboBox on a form? | Excel Programming | |||
use of mouse track wheel on user form combobox... | Excel Programming | |||
Adding a counter to a User Form in Excel | Excel Programming |