View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Stringer[_9_] Stringer[_9_] is offline
external usenet poster
 
Posts: 1
Default Can I overtype a listbox item


Here's some added code to reference with if the combobox is from the
controls toolbar and in the worksheet.

Code:
--------------------
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Const WS_RANGE As String = "D17"

If Not Intersect(Target, Me.Range(WS_RANGE)) Is Nothing Then
With Target
Range("E17").Select
End With
End If


ComboBox1.List = _
Worksheets("Customer List").Range("A1") _
.CurrentRegion.Columns("A").Value

End Sub


Private Sub ComboBox1_LostFocus()
Dim Resp As Long
Dim DestCell As Range

If BlkProc = True Then Exit Sub
With Me.ComboBox1
If .Value = "" Then
'do nothing
Else
If .ListIndex = -1 Then
Resp = MsgBox(Prompt:="This is a new Customer Name, " _
& "Do you want to save it? " & .Value, _
Buttons:=vbYesNo)
If Resp = vbYes Then
Worksheets("Customer List").Select
End If
End If
End If
End With

ActiveCell.Offset(1, 0).Range("A1").Select
ActiveCell.Offset(-1, 0).Range("A1").Select

End Sub




--------------------


--
Stringer
------------------------------------------------------------------------
Stringer's Profile: http://www.thecodecage.com/forumz/member.php?userid=117
View this thread: http://www.thecodecage.com/forumz/sh...ad.php?t=60014