Hi Duncan,
I have done it using macros and here is the code for macro.
 
There is sheet called "Lists" from the column A, it reads values and makes it appear 
in the sheet you are dealing with.
 
So in case you want to change what is appearing inthe dropdown, then you can 
programtically update/insert new values into sheet "List". All updated values will 
appear in dropdown. 
 
I am bit new to POI. But found it very useful and effective. 
 
Regards,
Mahesh.
 
Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)
On Error Resume Next
Dim ws As Worksheet
Dim i As Integer
Dim rngDV As Range
Dim rng As Range
If Target.Count > 1 Then Exit Sub
Set ws = Worksheets("Lists")
If Target.Row > 1 Then
  On Error Resume Next
  Set rngDV = Cells.SpecialCells(xlCellTypeAllValidation)
  On Error GoTo 0
  If rngDV Is Nothing Then Exit Sub
  If Intersect(Target, rngDV) Is Nothing Then Exit Sub
  Set rng = ws.Range(Cells(1, Target.Column) & "List")
  If Application.WorksheetFunction _
    .CountIf(rng, Target.Value) Then
    Exit Sub
  Else
    'i = ws.Cells(Rows.Count, rng.Column).End(xlUp).Row + 1
    'ws.Cells(i, rng.Column).Value = Target.Value
    'Set rng = ws.Range(Cells(1, Target.Column) & "List")
    'rng.Sort Key1:=ws.Cells(1, rng.Column), _
     ' Order1:=xlAscending, Header:=xlNo, _
      'OrderCustom:=1, MatchCase:=False, _
      'Orientation:=xlTopToBottom
      Dim test
     Target.Value = ""
     
  End If
End If
End Sub
 
 


Duncan Krebs <[EMAIL PROTECTED]> wrote:
Hi,
I don't think HSSF enables you to create drop down values. You can create them 
manually in excel and then read the values using HSSF. If you decide to do that I ran 
into the bug of POI not being able to open a workbook when a cell with a drop down is 
selected. Hope that helps. - dkrebs


----- Original Message -----
From: aaz
Sent: 10/6/2004 1:31:07 PM
To: [EMAIL PROTECTED]
Subject: hssf drop down example?

> Hi all,
> Does anyone have any example code to create a spreadsheet that as a cell with a drop 
> down of selectable values in it? 
> 
> thanks
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


                
---------------------------------
Do you Yahoo!?
vote.yahoo.com - Register online to vote today!

Reply via email to