PC Review


Reply
Thread Tools Rate Thread

Adding to excel user form combobox

 
 
Gimp
Guest
Posts: n/a
 
      25th Jan 2007
hello - I have a combobox that has the source from D212. What I want
to acomplish is, if a user enters in something that is not found in the
dropdown, or D212 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?

 
Reply With Quote
 
 
 
 
=?Utf-8?B?S2FyaSBKIEtlaW5vbmVu?=
Guest
Posts: n/a
 
      25th Jan 2007
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" & "" & NextRow & "")
Set DynamicArea = .Range("DynamicArea")
End With
ComboBox1.ListFillRange = "DynamicArea"
End Sub

Regards,
Kari J Keinonen
 
Reply With Quote
 
merjet
Guest
Posts: n/a
 
      26th Jan 2007
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" & iRow)
ComboBox1.RowSource = rng.Worksheet.Name & "!" & rng.Address
End Sub

Hth,
Merjet

 
Reply With Quote
 
Gimp
Guest
Posts: n/a
 
      26th Jan 2007
Thanks...Merjet, worked like a charm....

On Jan 25, 10:26 pm, "merjet" <mer...@comcast.net> 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" & iRow)
> ComboBox1.RowSource = rng.Worksheet.Name & "!" & rng.Address
> End Sub
>
> Hth,
> Merjet


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Adding a specified number of rows in Excel, via a User Form BSGApollo Microsoft Excel Misc 0 21st Jun 2011 01:37 PM
User form ComboBox Items: Remember user entries? michelle.harshberger@gmail.com Microsoft Excel Programming 0 29th Mar 2007 06:41 PM
Adding WorksheetData to a ComboBox on a form? jsmarsha@charter.net Microsoft Excel Programming 6 8th Feb 2006 02:17 PM
Adding Items to the combobox from the second form =?Utf-8?B?UmFnaGF2ZW5kcmEgTXVkdWdhbA==?= Microsoft C# .NET 3 11th May 2005 09:54 AM
Adding a counter to a User Form in Excel Pam Microsoft Excel Programming 2 17th Aug 2004 02:55 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 02:00 AM.