View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.misc
Larry Larry is offline
external usenet poster
 
Posts: 30
Default Combo box in a worksheet

Howdy folks, sure appreciate you being there to help.

I was wondering if I could get some help with combo box stuff. I have
studied the contextures page and set up a box on a sheet but it did not work
as described.

I have a series of workbooks set up by year with each sheet representing an
auto in a managed fleet. I have code in "ThisWorkbook" to hide unused
columns, I have code in each sheet to make a dynamic list:see below. I have
code for auto inserting the date in cells of one column and a statice list of
initials in another.

I would really like for the dynamic list to autocomplete entries, and to
have the drop down formatted to look exactly as the list when opened. I set
up a combo box on the sheet and set the parameters as shown in contextures,
but it did not work in any way. Can anyone help me with this combo box issue?

this code is on each sheet:

Option Explicit

Private Sub Worksheet_Change(ByVal Target As Range)
On Error Resume Next
Dim ws As Worksheet
Dim i As Integer

Set ws = Worksheets("Lists")
If Target.Column = 1 And Target.Row 1 Then
If Application.WorksheetFunction.CountIf(ws.Range("Na meList"),
Target.Value) Then
Exit Sub
Else
i = ws.Cells(Rows.Count, 1).End(xlUp).Row + 1
ws.Range("A" & i).Value = Target.Value

End If
End If

End Sub

Sub Worksheet_SelectionChange(ByVal Target As Excel.Range)
'Automatically inserts today's date in cell in column C when selected
'if the cell was empty. Does not overwrite occupied cell.
If ActiveCell.Column = 3 Then 'Limits macro action to column C
If ActiveCell.Value = "" Then 'Check to see if Target cell empty
Selection.Value = Date 'Insert today's date in Target cell
End If
Else
End If
End Sub