Multiply choice in the cell at the Excel generation

May 16, 2011 at 12:33 PM

Is any way to create at Excel generation  in some cell support of multi value choice?

I have example how create necessary thing in the Excel, but it is necessary to use Vbscript to create Listbox and declaration of it handler

For Example t is necessary follow code:


Private Sub ListBox1_Change()
Dim i As Long, v, s As String
v = ListBox1.List
For i = LBound(v, 1) To UBound(v, 1)
    If ListBox1.Selected(i) Then s = s & v(i, 0) & "; "
s = Left(s, Len(s) - 2)
ActiveCell = s

End Sub

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If ActiveCell.Address Like "$I*" Then
    With ListBox1
        .Top = ActiveCell.Top
        .Left = ActiveCell.Left
        .Visible = True
        .ListFillRange = "Config!" & [Values].Address
    End With
    ListBox1.Visible = False
End If
End Sub

And couple handler and function calls in the code of the Excel book.

Unfortunately I can find any possibility to put VbScript code when I create Excel using PHPExcel

1. May I do what I need using PHPExcel if so please advice how

2. If not please advice any other ways or libraries that allow me to do what I need.


Nov 10, 2012 at 2:51 PM

At the present time, it is not possible to have macros in a file written by the PHPExcel.

On the other hand, he knows how to attach data validation information,like  Excel allows ; see in documentation Chapter 4.6.27, as well as the examples "15datavalidation" in the folder "test".

Check if this can satisfy you.